質問編集履歴
5
社内での略称A5ERをA5:SQL Mk-2と改めました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
### 前提・実現したいこと
|
2
2
|
|
3
3
|
現在、ウェブアプリ作成のため、Xampp3.22を利用して、DBを作成しています。
|
4
|
-
phpMyAdminで作成したDBを、
|
4
|
+
phpMyAdminで作成したDBを、A5:SQL Mk-2でリバース生成してER図を作成したいと思っています。
|
5
5
|
|
6
6
|
### 発生している問題・エラーメッセージ
|
7
|
-
phpMyAdminで設定したFKが、
|
7
|
+
phpMyAdminで設定したFKが、A5:SQL Mk-2で作成したER図上に反映されません。
|
8
8
|
リバース生成で出来上がったER図は、リレーションが結ばれておらず、FKも存在しませんが、
|
9
9
|
これは仕様でしょうか?
|
10
10
|
また、FKを設定するためにリレーションを結ぶと、必ず主キーがFKになってしまいます。
|
@@ -18,7 +18,7 @@
|
|
18
18
|
### 補足情報(FW/ツールのバージョンなど)
|
19
19
|
Xammpは、3.22
|
20
20
|
phpMyAdminのみ、最新バージョンにアップデートしております。
|
21
|
-
|
21
|
+
A5:SQL Mk-2も最新バージョンです。
|
22
22
|
|
23
23
|
###追記
|
24
24
|
データベースのバージョンは、mysql --versionを使って調べました。
|
4
タグを追加しました。
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
3
頂いたご質問に対して回答いたしました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -18,4 +18,158 @@
|
|
18
18
|
### 補足情報(FW/ツールのバージョンなど)
|
19
19
|
Xammpは、3.22
|
20
20
|
phpMyAdminのみ、最新バージョンにアップデートしております。
|
21
|
-
A5ERも最新バージョンです。
|
21
|
+
A5ERも最新バージョンです。
|
22
|
+
|
23
|
+
###追記
|
24
|
+
データベースのバージョンは、mysql --versionを使って調べました。
|
25
|
+
〇〇です!と言える知識がありませんので、以下でお許しください。
|
26
|
+
```
|
27
|
+
D:\xampp\mysql\bin>mysql --version
|
28
|
+
mysql Ver 15.1 Distrib 10.1.28-MariaDB, for Win32 (AMD64)
|
29
|
+
```
|
30
|
+
|
31
|
+
以下、phpMyAdminのエクスポート機能を使って出力したcreate文です。
|
32
|
+
```SQL
|
33
|
+
-- phpMyAdmin SQL Dump
|
34
|
+
-- version 4.8.3
|
35
|
+
-- https://www.phpmyadmin.net/
|
36
|
+
--
|
37
|
+
-- Host: localhost
|
38
|
+
-- Generation Time:
|
39
|
+
-- サーバのバージョン: 10.1.28-MariaDB
|
40
|
+
-- PHP Version: 7.1.11
|
41
|
+
|
42
|
+
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
43
|
+
SET AUTOCOMMIT = 0;
|
44
|
+
START TRANSACTION;
|
45
|
+
SET time_zone = "+00:00";
|
46
|
+
|
47
|
+
--
|
48
|
+
-- Database: `feeling_memory`
|
49
|
+
--
|
50
|
+
|
51
|
+
-- --------------------------------------------------------
|
52
|
+
|
53
|
+
--
|
54
|
+
-- テーブルの構造 `feel_conditions`
|
55
|
+
--
|
56
|
+
|
57
|
+
CREATE TABLE `feel_conditions` (
|
58
|
+
`id` int(11) NOT NULL,
|
59
|
+
`login_informations_id` int(11) NOT NULL,
|
60
|
+
`target_date` date NOT NULL,
|
61
|
+
`season_id` int(11) NOT NULL,
|
62
|
+
`weather_id` int(11) NOT NULL,
|
63
|
+
`temperature` int(11) NOT NULL,
|
64
|
+
`mood_value` int(11) NOT NULL,
|
65
|
+
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
66
|
+
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
67
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
68
|
+
|
69
|
+
--
|
70
|
+
-- テーブルのデータのダンプ `feel_conditions`
|
71
|
+
--
|
72
|
+
|
73
|
+
INSERT INTO `feel_conditions` (`id`, `login_informations_id`, `target_date`, `season_id`, `weather_id`, `temperature`, `mood_value`, `created_at`, `updated_at`) VALUES
|
74
|
+
(1, 1, '2018-11-06', 0, 0, 22, 5, '2018-11-06 21:56:01', '2018-11-06 21:58:24'),
|
75
|
+
(2, 2, '2018-11-16', 0, 0, 25, 2, '2018-11-06 22:05:26', '2018-11-06 22:05:30');
|
76
|
+
|
77
|
+
-- --------------------------------------------------------
|
78
|
+
|
79
|
+
--
|
80
|
+
-- テーブルの構造 `login_informations`
|
81
|
+
--
|
82
|
+
|
83
|
+
CREATE TABLE `login_informations` (
|
84
|
+
`id` int(11) NOT NULL,
|
85
|
+
`password` varchar(255) NOT NULL,
|
86
|
+
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
87
|
+
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
88
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
89
|
+
|
90
|
+
--
|
91
|
+
-- テーブルのデータのダンプ `login_informations`
|
92
|
+
--
|
93
|
+
|
94
|
+
INSERT INTO `login_informations` (`id`, `password`, `created_at`, `updated_at`) VALUES
|
95
|
+
(1, 'password', '2018-11-14 21:15:13', '2018-11-14 21:15:57'),
|
96
|
+
(2, 'password', '2018-11-14 21:15:13', '2018-11-14 21:15:57');
|
97
|
+
|
98
|
+
-- --------------------------------------------------------
|
99
|
+
|
100
|
+
--
|
101
|
+
-- テーブルの構造 `seasons`
|
102
|
+
--
|
103
|
+
|
104
|
+
CREATE TABLE `seasons` (
|
105
|
+
`id` int(11) NOT NULL,
|
106
|
+
`current_season` int(11) NOT NULL,
|
107
|
+
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
108
|
+
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
109
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
110
|
+
|
111
|
+
-- --------------------------------------------------------
|
112
|
+
|
113
|
+
--
|
114
|
+
-- テーブルの構造 `users`
|
115
|
+
--
|
116
|
+
|
117
|
+
CREATE TABLE `users` (
|
118
|
+
`id` int(11) NOT NULL,
|
119
|
+
`login_informations_id` int(11) NOT NULL,
|
120
|
+
`name` varchar(255) NOT NULL,
|
121
|
+
`birthday` date NOT NULL,
|
122
|
+
`sex` int(11) NOT NULL,
|
123
|
+
`weather_id` int(11) NOT NULL,
|
124
|
+
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
125
|
+
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
126
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
127
|
+
|
128
|
+
-- --------------------------------------------------------
|
129
|
+
|
130
|
+
--
|
131
|
+
-- テーブルの構造 `weather`
|
132
|
+
--
|
133
|
+
|
134
|
+
CREATE TABLE `weather` (
|
135
|
+
`id` int(11) NOT NULL,
|
136
|
+
`current_weather` int(11) NOT NULL,
|
137
|
+
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
138
|
+
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP
|
139
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
140
|
+
|
141
|
+
--
|
142
|
+
-- Indexes for dumped tables
|
143
|
+
--
|
144
|
+
|
145
|
+
--
|
146
|
+
-- Indexes for table `feel_conditions`
|
147
|
+
--
|
148
|
+
ALTER TABLE `feel_conditions`
|
149
|
+
ADD PRIMARY KEY (`id`);
|
150
|
+
|
151
|
+
--
|
152
|
+
-- Indexes for table `login_informations`
|
153
|
+
--
|
154
|
+
ALTER TABLE `login_informations`
|
155
|
+
ADD PRIMARY KEY (`id`);
|
156
|
+
|
157
|
+
--
|
158
|
+
-- Indexes for table `seasons`
|
159
|
+
--
|
160
|
+
ALTER TABLE `seasons`
|
161
|
+
ADD PRIMARY KEY (`id`);
|
162
|
+
|
163
|
+
--
|
164
|
+
-- Indexes for table `users`
|
165
|
+
--
|
166
|
+
ALTER TABLE `users`
|
167
|
+
ADD PRIMARY KEY (`id`);
|
168
|
+
|
169
|
+
--
|
170
|
+
-- Indexes for table `weather`
|
171
|
+
--
|
172
|
+
ALTER TABLE `weather`
|
173
|
+
ADD PRIMARY KEY (`id`);
|
174
|
+
COMMIT;
|
175
|
+
```
|
2
タイトルを正しく修正しました。
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
|
1
|
+
phpMyAdminで作成したER図に外部キーを設定したい。
|
body
CHANGED
File without changes
|
1
初心者マークを付けました。
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|