Browse Source

Cleanup after merge of #244

Maurits van der Schee 7 years ago
parent
commit
9b28263521

+ 1
- 117
tests/MysqlTest.php View File

@@ -79,6 +79,7 @@ class MysqlTest extends Tests
79 79
     public function seedDatabase($db, $capabilities)
80 80
     {
81 81
         $fixture = __DIR__.'/data/blog_mysql.sql';
82
+
82 83
         $contents = file_get_contents($fixture);
83 84
 
84 85
         if (!($capabilities & self::GIS)) {
@@ -98,121 +99,4 @@ class MysqlTest extends Tests
98 99
             die("Loading '$fixture' failed on statemement #$i with error:\n".mysqli_error($db)."\n");
99 100
         }
100 101
     }
101
-
102
-    /**
103
-     * Gets the path to the seed file based on the version of MySQL
104
-     *
105
-     * @return string
106
-     */
107
-    protected static function getSeedFile()
108
-    {
109
-        if (static::$mysql_version >= self::MYSQL_57) {
110
-            return __DIR__.'/data/blog_'.strtolower(static::$config['dbengine']).'_57.sql';
111
-        } elseif (static::$mysql_version >= self::MYSQL_56) {
112
-            return __DIR__.'/data/blog_'.strtolower(static::$config['dbengine']).'_56.sql';
113
-        }
114
-        return __DIR__.'/data/blog_'.strtolower(static::$config['dbengine']).'_55.sql';
115
-    }
116
-
117
-    public function testHidingPasswordColumn()
118
-    {
119
-        parent::testHidingPasswordColumn();
120
-    }
121
-
122
-    public function testMissingIntermediateTable()
123
-    {
124
-        $test = new API($this, static::$config);
125
-        $test->get('/users?include=posts,tags');
126
-        $test->expect('{"users":{"columns":["id","username","location"],"records":[[1,"user1",null]]},"posts":{"relations":{"user_id":"users.id"},"columns":["id","user_id","category_id","content"],"records":[[1,1,1,"blog started"],[2,1,2,"It works!"]]},"post_tags":{"relations":{"post_id":"posts.id"},"columns":["id","post_id","tag_id"],"records":[[1,1,1],[2,1,2],[3,2,1],[4,2,2]]},"tags":{"relations":{"id":"post_tags.tag_id"},"columns":["id","name"],"records":[[1,"funny"],[2,"important"]]}}');
127
-    }
128
-
129
-    public function testEditUserPassword()
130
-    {
131
-        parent::testEditUserPassword();
132
-    }
133
-
134
-    public function testEditUserLocation()
135
-    {
136
-        parent::testEditUserLocation();
137
-    }
138
-
139
-    public function testListUserLocations()
140
-    {
141
-        parent::testListUserLocations();
142
-    }
143
-
144
-    public function testEditUserWithId()
145
-    {
146
-        parent::testEditUserWithId();
147
-    }
148
-
149
-    public function testReadOtherUser()
150
-    {
151
-        parent::testReadOtherUser();
152
-    }
153
-
154
-    public function testEditOtherUser()
155
-    {
156
-        parent::testEditOtherUser();
157
-    }
158
-
159
-    public function testSpatialFilterWithin()
160
-    {
161
-        if (static::$mysql_version < self::MYSQL_56) {
162
-            $this->markTestSkipped("MySQL < 5.6 does not support JSON fields.");
163
-        }
164
-        parent::testSpatialFilterWithin();
165
-    }
166
-
167
-
168
-    public function testListProductsProperties()
169
-    {
170
-        if (static::$mysql_version < self::MYSQL_57) {
171
-            $this->markTestSkipped("MySQL < 5.7 does not support JSON fields.");
172
-        }
173
-        parent::testListProductsProperties();
174
-    }
175
-
176
-    public function testReadProductProperties()
177
-    {
178
-        if (static::$mysql_version < self::MYSQL_57) {
179
-            $this->markTestSkipped("MySQL < 5.7 does not support JSON fields.");
180
-        }
181
-        parent::testReadProductProperties();
182
-    }
183
-
184
-    public function testWriteProductProperties()
185
-    {
186
-        if (static::$mysql_version < self::MYSQL_57) {
187
-            $this->markTestSkipped("MySQL < 5.7 does not support JSON fields.");
188
-        }
189
-        parent::testWriteProductProperties();
190
-    }
191
-
192
-    public function testListProducts()
193
-    {
194
-        parent::testListProducts();
195
-    }
196
-
197
-    public function testAddProducts()
198
-    {
199
-        if (static::$mysql_version < self::MYSQL_57) {
200
-            $this->markTestSkipped("MySQL < 5.7 does not support JSON fields.");
201
-        }
202
-        parent::testAddProducts();
203
-    }
204
-
205
-    public function testSoftDeleteProducts()
206
-    {
207
-        if (static::$mysql_version < self::MYSQL_57) {
208
-            $test = new API($this, static::$config);
209
-            $test->delete('/products/1');
210
-            $test->expect('1');
211
-            $test->get('/products?columns=id,deleted_at');
212
-            $test->expect('{"products":{"columns":["id","deleted_at"],"records":[[1,"2013-12-11 11:10:09"]]}}');
213
-        } else {
214
-            parent::testSoftDeleteProducts();
215
-        }
216
-    }
217
-
218 102
 }

+ 1
- 101
tests/PostgresqlTest.php View File

@@ -95,108 +95,8 @@ class PostgresqlTest extends Tests
95 95
         foreach ($queries as $i=>$query) {
96 96
             if (!pg_query($db, $query.';')) {
97 97
                 $i++;
98
-                die("Loading '$seed_file' failed on statemement #$i with error:\n".print_r( pg_last_error($db), true)."\n");
98
+                die("Loading '$fixture' failed on statemement #$i with error:\n".print_r( pg_last_error($db), true)."\n");
99 99
             }
100 100
         }
101 101
     }
102
-
103
-    /**
104
-     * Gets the path to the seed file based on the version of Postgres and GIS extension
105
-     *
106
-     * @return string
107
-     */
108
-    protected function getSeedFile()
109
-    {
110
-        $filepath = __DIR__.'/data/blog_'.strtolower(static::$config['dbengine']);
111
-
112
-        if (version_compare(static::$pg_server_version, '9.4.0') >= 0 ) {
113
-            $filepath .= '_94';
114
-        } elseif (version_compare(static::$pg_server_version, '9.2.0') >= 0 ) {
115
-            $filepath .= '_92';
116
-        } else {
117
-            $filepath .= '_91';
118
-        }
119
-        if (static::$gis_installed) {
120
-            $filepath .= '_gis';
121
-        }
122
-        return $filepath.'.sql';
123
-    }
124
-
125
-    /**
126
-     * Determines whether the GIS extension is installed or not based on array of extensions.
127
-     *
128
-     * @return boolean
129
-     */
130
-    protected function isGisInstalled($extensions = [])
131
-    {
132
-        static::$gis_installed = false;
133
-        if ($extensions) {
134
-            foreach ($extensions as $extension) {
135
-                if ($extension['extname'] === 'postgis') {
136
-                    static::$gis_installed = true;
137
-                    break;
138
-                }
139
-            }
140
-        }
141
-        return static::$gis_installed;
142
-    }
143
-
144
-    public function testSpatialFilterWithin()
145
-    {
146
-        if (!static::$gis_installed) {
147
-            $this->markTestSkipped("Postgis not installed");
148
-        }
149
-        parent::testSpatialFilterWithin();
150
-    }
151
-
152
-    public function testListProductsProperties()
153
-    {
154
-        if (version_compare(static::$pg_server_version, '9.2.0') < 0) {
155
-            $this->markTestSkipped("Postgres < 9.2.0 does not support JSON fields.");
156
-        }
157
-        parent::testListProductsProperties();
158
-    }
159
-
160
-    public function testReadProductProperties()
161
-    {
162
-        if (version_compare(static::$pg_server_version, '9.2.0') < 0) {
163
-            $this->markTestSkipped("Postgres < 9.2.0 does not support JSON fields.");
164
-        }
165
-        parent::testReadProductProperties();
166
-    }
167
-
168
-    public function testWriteProductProperties()
169
-    {
170
-        if (version_compare(static::$pg_server_version, '9.2.0') < 0) {
171
-            $this->markTestSkipped("Postgres < 9.2.0 does not support JSON fields.");
172
-        }
173
-        parent::testWriteProductProperties();
174
-    }
175
-
176
-    public function testListProducts()
177
-    {
178
-        parent::testListProducts();
179
-    }
180
-
181
-    public function testAddProducts()
182
-    {
183
-        if (version_compare(static::$pg_server_version, '9.2.0') < 0) {
184
-            $this->markTestSkipped("Postgres < 9.2.0 does not support JSON fields.");
185
-        }
186
-        parent::testAddProducts();
187
-    }
188
-
189
-    public function testSoftDeleteProducts()
190
-    {
191
-        if (version_compare(static::$pg_server_version, '9.2.0') < 0) {
192
-            $test = new API($this, static::$config);
193
-            $test->delete('/products/1');
194
-            $test->expect('1');
195
-            $test->get('/products?columns=id,deleted_at');
196
-            $test->expect('{"products":{"columns":["id","deleted_at"],"records":[[1,"2013-12-11 11:10:09"]]}}');
197
-        } else {
198
-            parent::testSoftDeleteProducts();
199
-        }
200
-    }
201
-
202 102
 }

tests/data/blog_mysql_57.sql → tests/data/blog_mysql.sql View File


+ 0
- 146
tests/data/blog_mysql_55.sql View File

@@ -1,148 +0,0 @@
1
-
2
-SET NAMES utf8;
3
-SET time_zone = '+00:00';
4
-SET foreign_key_checks = 0;
5
-SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
6
-
7
-DROP TABLE IF EXISTS `categories`;
8
-CREATE TABLE `categories` (
9
-  `id` int(11) NOT NULL AUTO_INCREMENT,
10
-  `name` varchar(255) NOT NULL,
11
-  `icon` blob NULL,
12
-  PRIMARY KEY (`id`)
13
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
14
-
15
-INSERT INTO `categories` (`id`, `name`, `icon`) VALUES
16
-(1,	'announcement',	NULL),
17
-(2,	'article',	NULL);
18
-
19
-DROP TABLE IF EXISTS `comments`;
20
-CREATE TABLE `comments` (
21
-  `id` int(11) NOT NULL AUTO_INCREMENT,
22
-  `post_id` int(11) NOT NULL,
23
-  `message` varchar(255) NOT NULL,
24
-  PRIMARY KEY (`id`),
25
-  KEY `post_id` (`post_id`),
26
-  CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`)
27
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
28
-
29
-INSERT INTO `comments` (`id`, `post_id`, `message`) VALUES
30
-(1,	1,	'great'),
31
-(2,	1,	'fantastic'),
32
-(3,	2,	'thank you'),
33
-(4,	2,	'awesome');
34
-
35
-DROP TABLE IF EXISTS `posts`;
36
-CREATE TABLE `posts` (
37
-  `id` int(11) NOT NULL AUTO_INCREMENT,
38
-  `user_id` int(11) NOT NULL,
39
-  `category_id` int(11) NOT NULL,
40
-  `content` varchar(255) NOT NULL,
41
-  PRIMARY KEY (`id`),
42
-  KEY `category_id` (`category_id`),
43
-  KEY `user_id` (`user_id`),
44
-  CONSTRAINT `posts_ibfk_3` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`),
45
-  CONSTRAINT `posts_ibfk_4` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
46
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
47
-
48
-INSERT INTO `posts` (`id`, `user_id`, `category_id`, `content`) VALUES
49
-(1,	1,	1,	'blog started'),
50
-(2,	1,	2,	'It works!');
51
-
52
-DROP TABLE IF EXISTS `post_tags`;
53
-CREATE TABLE `post_tags` (
54
-  `id` int(11) NOT NULL AUTO_INCREMENT,
55
-  `post_id` int(11) NOT NULL,
56
-  `tag_id` int(11) NOT NULL,
57
-  PRIMARY KEY (`id`),
58
-  KEY `post_id` (`post_id`),
59
-  KEY `tag_id` (`tag_id`),
60
-  CONSTRAINT `post_tags_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`),
61
-  CONSTRAINT `post_tags_ibfk_2` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`)
62
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
63
-
64
-INSERT INTO `post_tags` (`id`, `post_id`, `tag_id`) VALUES
65
-(1,	1,	1),
66
-(2,	1,	2),
67
-(3,	2,	1),
68
-(4,	2,	2);
69
-
70
-DROP TABLE IF EXISTS `tags`;
71
-CREATE TABLE `tags` (
72
-  `id` int(11) NOT NULL AUTO_INCREMENT,
73
-  `name` varchar(255) NOT NULL,
74
-  PRIMARY KEY (`id`)
75
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
76
-
77
-INSERT INTO `tags` (`id`, `name`) VALUES
78
-(1,	'funny'),
79
-(2,	'important');
80
-
81
-DROP TABLE IF EXISTS `users`;
82
-CREATE TABLE `users` (
83
-  `id` int(11) NOT NULL AUTO_INCREMENT,
84
-  `username` varchar(255) NOT NULL,
85
-  `password` varchar(255) NOT NULL,
86
-  `location` text NULL,
87
-  PRIMARY KEY (`id`)
88
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
89
-
90
-INSERT INTO `users` (`id`, `username`, `password`, `location`) VALUES
91
-(1,	'user1',	'pass1', null),
92
-(2,	'user2',	'pass2', null);
93
-
94
-DROP TABLE IF EXISTS `countries`;
95
-CREATE TABLE `countries` (
96
-  `id` int(11) NOT NULL AUTO_INCREMENT,
97
-  `name` varchar(255) NOT NULL,
98
-  PRIMARY KEY (`id`)
99
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
100
-
101
-INSERT INTO `countries` (`id`, `name`) VALUES
102
-(1,	'Left'),
103
-(2,	'Right');
104
-
105
-DROP TABLE IF EXISTS `events`;
106
-CREATE TABLE `events` (
107
-  `id` int(11) NOT NULL AUTO_INCREMENT,
108
-  `name` varchar(255) NOT NULL,
109
-  `datetime` datetime NOT NULL,
110
-  `visitors` int(11) NOT NULL,
111
-  PRIMARY KEY (`id`)
112
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
113
-
114
-INSERT INTO `events` (`id`, `name`, `datetime`, `visitors`) VALUES
115
-(1,	'Launch', '2016-01-01 13:01:01', 0);
116
-
117
-DROP VIEW IF EXISTS `tag_usage`;
118
-CREATE VIEW `tag_usage` AS select `name`, count(`name`) AS `count` from `tags`, `post_tags` where `tags`.`id` = `post_tags`.`tag_id` group by `name` order by `count` desc, `name`;
119
-
120
-DROP TABLE IF EXISTS `products`;
121
-CREATE TABLE `products` (
122
-  `id` int(11) NOT NULL AUTO_INCREMENT,
123
-  `name` varchar(255) NOT NULL,
124
-  `price` decimal(10,2) NOT NULL,
125
-  `properties` text NOT NULL,
126
-  `created_at` datetime NOT NULL,
127
-  `deleted_at` datetime NULL,
128
-  PRIMARY KEY (`id`)
129
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
130
-
131
-INSERT INTO `products` (`id`, `name`, `price`, `properties`, `created_at`) VALUES
132
-(1,	'Calculator', '23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01');
133
-
134
-DROP TABLE IF EXISTS `barcodes`;
135
-CREATE TABLE `barcodes` (
136
-  `id` int(11) NOT NULL AUTO_INCREMENT,
137
-  `product_id` int(11) NOT NULL,
138
-  `hex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
139
-  `bin` varbinary(255) NOT NULL,
140
-  PRIMARY KEY (`id`),
141
-  CONSTRAINT `barcodes_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`)
142
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
143
-
144
-INSERT INTO `barcodes` (`id`, `product_id`, `hex`, `bin`) VALUES
145
-(1,	1, '00ff01', UNHEX('00ff01'));
146
-

+ 0
- 147
tests/data/blog_mysql_56.sql View File

@@ -1,149 +0,0 @@
1
-
2
-SET NAMES utf8;
3
-SET time_zone = '+00:00';
4
-SET foreign_key_checks = 0;
5
-SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
6
-
7
-DROP TABLE IF EXISTS `categories`;
8
-CREATE TABLE `categories` (
9
-  `id` int(11) NOT NULL AUTO_INCREMENT,
10
-  `name` varchar(255) NOT NULL,
11
-  `icon` blob NULL,
12
-  PRIMARY KEY (`id`)
13
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
14
-
15
-INSERT INTO `categories` (`id`, `name`, `icon`) VALUES
16
-(1,	'announcement',	NULL),
17
-(2,	'article',	NULL);
18
-
19
-DROP TABLE IF EXISTS `comments`;
20
-CREATE TABLE `comments` (
21
-  `id` int(11) NOT NULL AUTO_INCREMENT,
22
-  `post_id` int(11) NOT NULL,
23
-  `message` varchar(255) NOT NULL,
24
-  PRIMARY KEY (`id`),
25
-  KEY `post_id` (`post_id`),
26
-  CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`)
27
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
28
-
29
-INSERT INTO `comments` (`id`, `post_id`, `message`) VALUES
30
-(1,	1,	'great'),
31
-(2,	1,	'fantastic'),
32
-(3,	2,	'thank you'),
33
-(4,	2,	'awesome');
34
-
35
-DROP TABLE IF EXISTS `posts`;
36
-CREATE TABLE `posts` (
37
-  `id` int(11) NOT NULL AUTO_INCREMENT,
38
-  `user_id` int(11) NOT NULL,
39
-  `category_id` int(11) NOT NULL,
40
-  `content` varchar(255) NOT NULL,
41
-  PRIMARY KEY (`id`),
42
-  KEY `category_id` (`category_id`),
43
-  KEY `user_id` (`user_id`),
44
-  CONSTRAINT `posts_ibfk_3` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`),
45
-  CONSTRAINT `posts_ibfk_4` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
46
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
47
-
48
-INSERT INTO `posts` (`id`, `user_id`, `category_id`, `content`) VALUES
49
-(1,	1,	1,	'blog started'),
50
-(2,	1,	2,	'It works!');
51
-
52
-DROP TABLE IF EXISTS `post_tags`;
53
-CREATE TABLE `post_tags` (
54
-  `id` int(11) NOT NULL AUTO_INCREMENT,
55
-  `post_id` int(11) NOT NULL,
56
-  `tag_id` int(11) NOT NULL,
57
-  PRIMARY KEY (`id`),
58
-  KEY `post_id` (`post_id`),
59
-  KEY `tag_id` (`tag_id`),
60
-  CONSTRAINT `post_tags_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`),
61
-  CONSTRAINT `post_tags_ibfk_2` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`)
62
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
63
-
64
-INSERT INTO `post_tags` (`id`, `post_id`, `tag_id`) VALUES
65
-(1,	1,	1),
66
-(2,	1,	2),
67
-(3,	2,	1),
68
-(4,	2,	2);
69
-
70
-DROP TABLE IF EXISTS `tags`;
71
-CREATE TABLE `tags` (
72
-  `id` int(11) NOT NULL AUTO_INCREMENT,
73
-  `name` varchar(255) NOT NULL,
74
-  PRIMARY KEY (`id`)
75
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
76
-
77
-INSERT INTO `tags` (`id`, `name`) VALUES
78
-(1,	'funny'),
79
-(2,	'important');
80
-
81
-DROP TABLE IF EXISTS `users`;
82
-CREATE TABLE `users` (
83
-  `id` int(11) NOT NULL AUTO_INCREMENT,
84
-  `username` varchar(255) NOT NULL,
85
-  `password` varchar(255) NOT NULL,
86
-  `location` point NULL,
87
-  PRIMARY KEY (`id`)
88
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
89
-
90
-INSERT INTO `users` (`id`, `username`, `password`, `location`) VALUES
91
-(1,	'user1',	'pass1', null),
92
-(2,	'user2',	'pass2', null);
93
-
94
-DROP TABLE IF EXISTS `countries`;
95
-CREATE TABLE `countries` (
96
-  `id` int(11) NOT NULL AUTO_INCREMENT,
97
-  `name` varchar(255) NOT NULL,
98
-  `shape` polygon NOT NULL,
99
-  PRIMARY KEY (`id`)
100
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
101
-
102
-INSERT INTO `countries` (`id`, `name`, `shape`) VALUES
103
-(1,	'Left',	ST_GeomFromText('POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))')),
104
-(2,	'Right',	ST_GeomFromText('POLYGON ((70 10, 80 40, 60 40, 50 20, 70 10))'));
105
-
106
-DROP TABLE IF EXISTS `events`;
107
-CREATE TABLE `events` (
108
-  `id` int(11) NOT NULL AUTO_INCREMENT,
109
-  `name` varchar(255) NOT NULL,
110
-  `datetime` datetime NOT NULL,
111
-  `visitors` int(11) NOT NULL,
112
-  PRIMARY KEY (`id`)
113
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
114
-
115
-INSERT INTO `events` (`id`, `name`, `datetime`, `visitors`) VALUES
116
-(1,	'Launch', '2016-01-01 13:01:01', 0);
117
-
118
-DROP VIEW IF EXISTS `tag_usage`;
119
-CREATE VIEW `tag_usage` AS select `name`, count(`name`) AS `count` from `tags`, `post_tags` where `tags`.`id` = `post_tags`.`tag_id` group by `name` order by `count` desc, `name`;
120
-
121
-DROP TABLE IF EXISTS `products`;
122
-CREATE TABLE `products` (
123
-  `id` int(11) NOT NULL AUTO_INCREMENT,
124
-  `name` varchar(255) NOT NULL,
125
-  `price` decimal(10,2) NOT NULL,
126
-  `properties` text NOT NULL,
127
-  `created_at` datetime NOT NULL,
128
-  `deleted_at` datetime NULL,
129
-  PRIMARY KEY (`id`)
130
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
131
-
132
-INSERT INTO `products` (`id`, `name`, `price`, `properties`, `created_at`) VALUES
133
-(1,	'Calculator', '23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01');
134
-
135
-DROP TABLE IF EXISTS `barcodes`;
136
-CREATE TABLE `barcodes` (
137
-  `id` int(11) NOT NULL AUTO_INCREMENT,
138
-  `product_id` int(11) NOT NULL,
139
-  `hex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
140
-  `bin` varbinary(255) NOT NULL,
141
-  PRIMARY KEY (`id`),
142
-  CONSTRAINT `barcodes_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`)
143
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
144
-
145
-INSERT INTO `barcodes` (`id`, `product_id`, `hex`, `bin`) VALUES
146
-(1,	1, '00ff01', UNHEX('00ff01'));
147
-

tests/data/blog_postgresql_94_gis.sql → tests/data/blog_postgresql.sql View File


+ 0
- 339
tests/data/blog_postgresql_91.sql View File

@@ -1,383 +0,0 @@
1
---
2
---
3
-
4
-SET statement_timeout = 0;
5
-SET client_encoding = 'UTF8';
6
-SET standard_conforming_strings = on;
7
-SET check_function_bodies = false;
8
-SET client_min_messages = warning;
9
-
10
-SET search_path = public, pg_catalog;
11
-
12
-SET default_tablespace = '';
13
-
14
-SET default_with_oids = false;
15
-
16
---
17
---
18
-
19
-DROP TABLE IF EXISTS categories CASCADE;
20
-DROP TABLE IF EXISTS comments CASCADE;
21
-DROP TABLE IF EXISTS post_tags CASCADE;
22
-DROP TABLE IF EXISTS posts CASCADE;
23
-DROP TABLE IF EXISTS tags CASCADE;
24
-DROP TABLE IF EXISTS users CASCADE;
25
-DROP TABLE IF EXISTS events CASCADE;
26
-DROP VIEW IF EXISTS tag_usage;
27
-DROP TABLE IF EXISTS products CASCADE;
28
-DROP TABLE IF EXISTS barcodes CASCADE;
29
-
30
---
31
---
32
-
33
-CREATE TABLE categories (
34
-    id serial NOT NULL,
35
-    name character varying(255) NOT NULL,
36
-    icon bytea
37
-);
38
-
39
-
40
---
41
---
42
-
43
-CREATE TABLE comments (
44
-    id serial NOT NULL,
45
-    post_id integer NOT NULL,
46
-    message character varying(255) NOT NULL
47
-);
48
-
49
-
50
---
51
---
52
-
53
-CREATE TABLE post_tags (
54
-    id serial NOT NULL,
55
-    post_id integer NOT NULL,
56
-    tag_id integer NOT NULL
57
-);
58
-
59
-
60
---
61
---
62
-
63
-CREATE TABLE posts (
64
-    id serial NOT NULL,
65
-    user_id integer NOT NULL,
66
-    category_id integer NOT NULL,
67
-    content character varying(255) NOT NULL
68
-);
69
-
70
-
71
---
72
---
73
-
74
-CREATE TABLE tags (
75
-    id serial NOT NULL,
76
-    name character varying(255) NOT NULL
77
-);
78
-
79
-
80
---
81
---
82
-
83
-CREATE TABLE users (
84
-    id serial NOT NULL,
85
-    username character varying(255) NOT NULL,
86
-    password character varying(255) NOT NULL,
87
-    location text NULL
88
-);
89
-
90
---
91
---
92
-
93
-CREATE TABLE events (
94
-    id serial NOT NULL,
95
-    name character varying(255) NOT NULL,
96
-    datetime timestamp NOT NULL,
97
-    visitors integer NOT NULL
98
-);
99
-
100
---
101
---
102
-
103
-CREATE VIEW "tag_usage" AS select "name", count("name") AS "count" from "tags", "post_tags" where "tags"."id" = "post_tags"."tag_id" group by "name" order by "count" desc, "name";
104
-
105
---
106
---
107
-
108
-CREATE TABLE products (
109
-    id serial NOT NULL,
110
-    name character varying(255) NOT NULL,
111
-    price decimal(10,2) NOT NULL,
112
-    properties text NULL,
113
-    created_at timestamp NOT NULL,
114
-    deleted_at timestamp NULL
115
-);
116
-
117
---
118
---
119
-
120
-CREATE TABLE barcodes (
121
-    id serial NOT NULL,
122
-    product_id integer NOT NULL,
123
-    hex character varying(255) NOT NULL,
124
-    bin bytea NOT NULL
125
-);
126
-
127
---
128
---
129
-
130
-INSERT INTO "categories" ("name", "icon") VALUES
131
-('announcement',	NULL),
132
-('article',	NULL);
133
-
134
---
135
---
136
-
137
-INSERT INTO "comments" ("post_id", "message") VALUES
138
-(1,	'great'),
139
-(1,	'fantastic'),
140
-(2,	'thank you'),
141
-(2,	'awesome');
142
-
143
---
144
---
145
-
146
-INSERT INTO "post_tags" ("post_id", "tag_id") VALUES
147
-(1,	1),
148
-(1,	2),
149
-(2,	1),
150
-(2,	2);
151
-
152
---
153
---
154
-
155
-INSERT INTO "posts" ("user_id", "category_id", "content") VALUES
156
-(1,	1,	'blog started'),
157
-(1,	2,	'It works!');
158
-
159
---
160
---
161
-
162
-INSERT INTO "tags" ("name") VALUES
163
-('funny'),
164
-('important');
165
-
166
---
167
---
168
-
169
-INSERT INTO "users" ("username", "password", "location") VALUES
170
-('user1',	'pass1',	NULL),
171
-('user2',	'pass2',	NULL);
172
-
173
---
174
---
175
-
176
-INSERT INTO "events" ("name", "datetime", "visitors") VALUES
177
-('Launch',	'2016-01-01 13:01:01',	0);
178
-
179
---
180
---
181
-
182
-INSERT INTO "products" ("name", "price", "properties", "created_at") VALUES
183
-('Calculator',	'23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01');
184
-
185
---
186
---
187
-
188
-INSERT INTO "barcodes" ("product_id", "hex", "bin") VALUES
189
-(1,	'00ff01', E'\\x00ff01');
190
-
191
---
192
---
193
-
194
-ALTER TABLE ONLY categories
195
-    ADD CONSTRAINT categories_pkey PRIMARY KEY (id);
196
-
197
-
198
---
199
---
200
-
201
-ALTER TABLE ONLY comments
202
-    ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
203
-
204
-
205
---
206
---
207
-
208
-ALTER TABLE ONLY post_tags
209
-    ADD CONSTRAINT post_tags_pkey PRIMARY KEY (id);
210
-
211
-
212
---
213
---
214
-
215
-ALTER TABLE ONLY post_tags
216
-    ADD CONSTRAINT post_tags_post_id_tag_id_key UNIQUE (post_id, tag_id);
217
-
218
-
219
---
220
---
221
-
222
-ALTER TABLE ONLY posts
223
-    ADD CONSTRAINT posts_pkey PRIMARY KEY (id);
224
-
225
-
226
---
227
---
228
-
229
-ALTER TABLE ONLY tags
230
-    ADD CONSTRAINT tags_pkey PRIMARY KEY (id);
231
-
232
-
233
---
234
---
235
-
236
-ALTER TABLE ONLY users
237
-    ADD CONSTRAINT users_pkey PRIMARY KEY (id);
238
-
239
---
240
---
241
-
242
-ALTER TABLE ONLY events
243
-    ADD CONSTRAINT events_pkey PRIMARY KEY (id);
244
-
245
-
246
---
247
---
248
-
249
-ALTER TABLE ONLY products
250
-    ADD CONSTRAINT products_pkey PRIMARY KEY (id);
251
-
252
-
253
---
254
---
255
-
256
-ALTER TABLE ONLY barcodes
257
-    ADD CONSTRAINT barcodes_pkey PRIMARY KEY (id);
258
-
259
-
260
---
261
---
262
-
263
-CREATE INDEX comments_post_id_idx ON comments USING btree (post_id);
264
-
265
-
266
---
267
---
268
-
269
-CREATE INDEX post_tags_post_id_idx ON post_tags USING btree (post_id);
270
-
271
-
272
---
273
---
274
-
275
-CREATE INDEX post_tags_tag_id_idx ON post_tags USING btree (tag_id);
276
-
277
-
278
---
279
---
280
-
281
-CREATE INDEX posts_category_id_idx ON posts USING btree (category_id);
282
-
283
-
284
---
285
---
286
-
287
-CREATE INDEX posts_user_id_idx ON posts USING btree (user_id);
288
-
289
-
290
---
291
---
292
-
293
-CREATE INDEX barcodes_product_id_idx ON barcodes USING btree (product_id);
294
-
295
-
296
---
297
---
298
-
299
-ALTER TABLE ONLY comments
300
-    ADD CONSTRAINT comments_post_id_fkey FOREIGN KEY (post_id) REFERENCES posts(id);
301
-
302
-
303
---
304
---
305
-
306
-ALTER TABLE ONLY post_tags
307
-    ADD CONSTRAINT post_tags_post_id_fkey FOREIGN KEY (post_id) REFERENCES posts(id);
308
-
309
-
310
---
311
---
312
-
313
-ALTER TABLE ONLY post_tags
314
-    ADD CONSTRAINT post_tags_tag_id_fkey FOREIGN KEY (tag_id) REFERENCES tags(id);
315
-
316
-
317
---
318
---
319
-
320
-ALTER TABLE ONLY posts
321
-    ADD CONSTRAINT posts_category_id_fkey FOREIGN KEY (category_id) REFERENCES categories(id);
322
-
323
-
324
---
325
---
326
-
327
-ALTER TABLE ONLY posts
328
-    ADD CONSTRAINT posts_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
329
-
330
-
331
---
332
---
333
-
334
-ALTER TABLE ONLY barcodes
335
-    ADD CONSTRAINT barcodes_product_id_fkey FOREIGN KEY (product_id) REFERENCES products(id);
336
-
337
-
338
---
339
---

+ 0
- 368
tests/data/blog_postgresql_91_gis.sql View File

@@ -1,416 +0,0 @@
1
---
2
---
3
-
4
-SET statement_timeout = 0;
5
-SET client_encoding = 'UTF8';
6
-SET standard_conforming_strings = on;
7
-SET check_function_bodies = false;
8
-SET client_min_messages = warning;
9
-
10
-SET search_path = public, pg_catalog;
11
-
12
-SET default_tablespace = '';
13
-
14
-SET default_with_oids = false;
15
-
16
---
17
---
18
-
19
-DROP TABLE IF EXISTS categories CASCADE;
20
-DROP TABLE IF EXISTS comments CASCADE;
21
-DROP TABLE IF EXISTS post_tags CASCADE;
22
-DROP TABLE IF EXISTS posts CASCADE;
23
-DROP TABLE IF EXISTS tags CASCADE;
24
-DROP TABLE IF EXISTS users CASCADE;
25
-DROP TABLE IF EXISTS countries CASCADE;
26
-DROP TABLE IF EXISTS events CASCADE;
27
-DROP VIEW IF EXISTS tag_usage;
28
-DROP TABLE IF EXISTS products CASCADE;
29
-DROP TABLE IF EXISTS barcodes CASCADE;
30
-
31
---
32
---
33
-
34
-CREATE EXTENSION IF NOT EXISTS postgis;
35
-
36
---
37
---
38
-
39
-CREATE TABLE categories (
40
-    id serial NOT NULL,
41
-    name character varying(255) NOT NULL,
42
-    icon bytea
43
-);
44
-
45
-
46
---
47
---
48
-
49
-CREATE TABLE comments (
50
-    id serial NOT NULL,
51
-    post_id integer NOT NULL,
52
-    message character varying(255) NOT NULL
53
-);
54
-
55
-
56
---
57
---
58
-
59
-CREATE TABLE post_tags (
60
-    id serial NOT NULL,
61
-    post_id integer NOT NULL,
62
-    tag_id integer NOT NULL
63
-);
64
-
65
-
66
---
67
---
68
-
69
-CREATE TABLE posts (
70
-    id serial NOT NULL,
71
-    user_id integer NOT NULL,
72
-    category_id integer NOT NULL,
73
-    content character varying(255) NOT NULL
74
-);
75
-
76
-
77
---
78
---
79
-
80
-CREATE TABLE tags (
81
-    id serial NOT NULL,
82
-    name character varying(255) NOT NULL
83
-);
84
-
85
-
86
---
87
---
88
-
89
-CREATE TABLE users (
90
-    id serial NOT NULL,
91
-    username character varying(255) NOT NULL,
92
-    password character varying(255) NOT NULL,
93
-    location geometry NULL
94
-);
95
-
96
---
97
---
98
-
99
-CREATE TABLE countries (
100
-    id serial NOT NULL,
101
-    name character varying(255) NOT NULL,
102
-    shape geometry NOT NULL
103
-);
104
-
105
---
106
---
107
-
108
-CREATE TABLE events (
109
-    id serial NOT NULL,
110
-    name character varying(255) NOT NULL,
111
-    datetime timestamp NOT NULL,
112
-    visitors integer NOT NULL
113
-);
114
-
115
---
116
---
117
-
118
-CREATE VIEW "tag_usage" AS select "name", count("name") AS "count" from "tags", "post_tags" where "tags"."id" = "post_tags"."tag_id" group by "name" order by "count" desc, "name";
119
-
120
---
121
---
122
-
123
-CREATE TABLE products (
124
-    id serial NOT NULL,
125
-    name character varying(255) NOT NULL,
126
-    price decimal(10,2) NOT NULL,
127
-    properties text NULL,
128
-    created_at timestamp NOT NULL,
129
-    deleted_at timestamp NULL
130
-);
131
-
132
---
133
---
134
-
135
-CREATE TABLE barcodes (
136
-    id serial NOT NULL,
137
-    product_id integer NOT NULL,
138
-    hex character varying(255) NOT NULL,
139
-    bin bytea NOT NULL
140
-);
141
-
142
---
143
---
144
-
145
-INSERT INTO "categories" ("name", "icon") VALUES
146
-('announcement',	NULL),
147
-('article',	NULL);
148
-
149
---
150
---
151
-
152
-INSERT INTO "comments" ("post_id", "message") VALUES
153
-(1,	'great'),
154
-(1,	'fantastic'),
155
-(2,	'thank you'),
156
-(2,	'awesome');
157
-
158
---
159
---
160
-
161
-INSERT INTO "post_tags" ("post_id", "tag_id") VALUES
162
-(1,	1),
163
-(1,	2),
164
-(2,	1),
165
-(2,	2);
166
-
167
---
168
---
169
-
170
-INSERT INTO "posts" ("user_id", "category_id", "content") VALUES
171
-(1,	1,	'blog started'),
172
-(1,	2,	'It works!');
173
-
174
---
175
---
176
-
177
-INSERT INTO "tags" ("name") VALUES
178
-('funny'),
179
-('important');
180
-
181
---
182
---
183
-
184
-INSERT INTO "users" ("username", "password", "location") VALUES
185
-('user1',	'pass1',	NULL),
186
-('user2',	'pass2',	NULL);
187
-
188
---
189
---
190
-
191
-INSERT INTO "countries" ("name", "shape") VALUES
192
-('Left',	ST_GeomFromText('POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))')),
193
-('Right',	ST_GeomFromText('POLYGON ((70 10, 80 40, 60 40, 50 20, 70 10))'));
194
-
195
---
196
---
197
-
198
-INSERT INTO "events" ("name", "datetime", "visitors") VALUES
199
-('Launch',	'2016-01-01 13:01:01',	0);
200
-
201
---
202
---
203
-
204
-INSERT INTO "products" ("name", "price", "properties", "created_at") VALUES
205
-('Calculator',	'23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01');
206
-
207
---
208
---
209
-
210
-INSERT INTO "barcodes" ("product_id", "hex", "bin") VALUES
211
-(1,	'00ff01', E'\\x00ff01');
212
-
213
---
214
---
215
-
216
-ALTER TABLE ONLY categories
217
-    ADD CONSTRAINT categories_pkey PRIMARY KEY (id);
218
-
219
-
220
---
221
---
222
-
223
-ALTER TABLE ONLY comments
224
-    ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
225
-
226
-
227
---
228
---
229
-
230
-ALTER TABLE ONLY post_tags
231
-    ADD CONSTRAINT post_tags_pkey PRIMARY KEY (id);
232
-
233
-
234
---
235
---
236
-
237
-ALTER TABLE ONLY post_tags
238
-    ADD CONSTRAINT post_tags_post_id_tag_id_key UNIQUE (post_id, tag_id);
239
-
240
-
241
---
242
---
243
-
244
-ALTER TABLE ONLY posts
245
-    ADD CONSTRAINT posts_pkey PRIMARY KEY (id);
246
-
247
-
248
---
249
---
250
-
251
-ALTER TABLE ONLY tags
252
-    ADD CONSTRAINT tags_pkey PRIMARY KEY (id);
253
-
254
-
255
---
256
---
257
-
258
-ALTER TABLE ONLY users
259
-    ADD CONSTRAINT users_pkey PRIMARY KEY (id);
260
-
261
---
262
---
263
-
264
-ALTER TABLE ONLY countries
265
-    ADD CONSTRAINT countries_pkey PRIMARY KEY (id);
266
-
267
-
268
---
269
---
270
-
271
-ALTER TABLE ONLY events
272
-    ADD CONSTRAINT events_pkey PRIMARY KEY (id);
273
-
274
-
275
---
276
---
277
-
278
-ALTER TABLE ONLY products
279
-    ADD CONSTRAINT products_pkey PRIMARY KEY (id);
280
-
281
-
282
---
283
---
284
-
285
-ALTER TABLE ONLY barcodes
286
-    ADD CONSTRAINT barcodes_pkey PRIMARY KEY (id);
287
-
288
-
289
---
290
---
291
-
292
-CREATE INDEX comments_post_id_idx ON comments USING btree (post_id);
293
-
294
-
295
---
296
---
297
-
298
-CREATE INDEX post_tags_post_id_idx ON post_tags USING btree (post_id);
299
-
300
-
301
---
302
---
303
-
304
-CREATE INDEX post_tags_tag_id_idx ON post_tags USING btree (tag_id);
305
-
306
-
307
---
308
---
309
-
310
-CREATE INDEX posts_category_id_idx ON posts USING btree (category_id);
311
-
312
-
313
---
314
---
315
-
316
-CREATE INDEX posts_user_id_idx ON posts USING btree (user_id);
317
-
318
-
319
---
320
---
321
-
322
-CREATE INDEX barcodes_product_id_idx ON barcodes USING btree (product_id);
323
-
324
-
325
---
326
---
327
-
328
-ALTER TABLE ONLY comments
329
-    ADD CONSTRAINT comments_post_id_fkey FOREIGN KEY (post_id) REFERENCES posts(id);
330
-
331
-
332
---
333
---
334
-
335
-ALTER TABLE ONLY post_tags
336
-    ADD CONSTRAINT post_tags_post_id_fkey FOREIGN KEY (post_id) REFERENCES posts(id);
337
-
338
-
339
---
340
---
341
-
342
-ALTER TABLE ONLY post_tags
343
-    ADD CONSTRAINT post_tags_tag_id_fkey FOREIGN KEY (tag_id) REFERENCES tags(id);
344
-
345
-
346
---
347
---
348
-
349
-ALTER TABLE ONLY posts
350
-    ADD CONSTRAINT posts_category_id_fkey FOREIGN KEY (category_id) REFERENCES categories(id);
351
-
352
-
353
---
354
---
355
-
356
-ALTER TABLE ONLY posts
357
-    ADD CONSTRAINT posts_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
358
-
359
-
360
---
361
---
362
-
363
-ALTER TABLE ONLY barcodes
364
-    ADD CONSTRAINT barcodes_product_id_fkey FOREIGN KEY (product_id) REFERENCES products(id);
365
-
366
-
367
---
368
---

+ 0
- 339
tests/data/blog_postgresql_92.sql View File

@@ -1,383 +0,0 @@
1
---
2
---
3
-
4
-SET statement_timeout = 0;
5
-SET client_encoding = 'UTF8';
6
-SET standard_conforming_strings = on;
7
-SET check_function_bodies = false;
8
-SET client_min_messages = warning;
9
-
10
-SET search_path = public, pg_catalog;
11
-
12
-SET default_tablespace = '';
13
-
14
-SET default_with_oids = false;
15
-
16
---
17
---
18
-
19
-DROP TABLE IF EXISTS categories CASCADE;
20
-DROP TABLE IF EXISTS comments CASCADE;
21
-DROP TABLE IF EXISTS post_tags CASCADE;
22
-DROP TABLE IF EXISTS posts CASCADE;
23
-DROP TABLE IF EXISTS tags CASCADE;
24
-DROP TABLE IF EXISTS users CASCADE;
25
-DROP TABLE IF EXISTS events CASCADE;
26
-DROP VIEW IF EXISTS tag_usage;
27
-DROP TABLE IF EXISTS products CASCADE;
28
-DROP TABLE IF EXISTS barcodes CASCADE;
29
-
30
---
31
---
32
-
33
-CREATE TABLE categories (
34
-    id serial NOT NULL,
35
-    name character varying(255) NOT NULL,
36
-    icon bytea
37
-);
38
-
39
-
40
---
41
---
42
-
43
-CREATE TABLE comments (
44
-    id serial NOT NULL,
45
-    post_id integer NOT NULL,
46
-    message character varying(255) NOT NULL
47
-);
48
-
49
-
50
---
51
---
52
-
53
-CREATE TABLE post_tags (
54
-    id serial NOT NULL,
55
-    post_id integer NOT NULL,
56
-    tag_id integer NOT NULL
57
-);
58
-
59
-
60
---
61
---
62
-
63
-CREATE TABLE posts (
64
-    id serial NOT NULL,
65
-    user_id integer NOT NULL,
66
-    category_id integer NOT NULL,
67
-    content character varying(255) NOT NULL
68
-);
69
-
70
-
71
---
72
---
73
-
74
-CREATE TABLE tags (
75
-    id serial NOT NULL,
76
-    name character varying(255) NOT NULL
77
-);
78
-
79
-
80
---
81
---
82
-
83
-CREATE TABLE users (
84
-    id serial NOT NULL,
85
-    username character varying(255) NOT NULL,
86
-    password character varying(255) NOT NULL,
87
-    location text NULL
88
-);
89
-
90
---
91
---
92
-
93
-CREATE TABLE events (
94
-    id serial NOT NULL,
95
-    name character varying(255) NOT NULL,
96
-    datetime timestamp NOT NULL,
97
-    visitors integer NOT NULL
98
-);
99
-
100
---
101
---
102
-
103
-CREATE VIEW "tag_usage" AS select "name", count("name") AS "count" from "tags", "post_tags" where "tags"."id" = "post_tags"."tag_id" group by "name" order by "count" desc, "name";
104
-
105
---
106
---
107
-
108
-CREATE TABLE products (
109
-    id serial NOT NULL,
110
-    name character varying(255) NOT NULL,
111
-    price decimal(10,2) NOT NULL,
112
-    properties json NOT NULL,
113
-    created_at timestamp NOT NULL,
114
-    deleted_at timestamp NULL
115
-);
116
-
117
---
118
---
119
-
120
-CREATE TABLE barcodes (
121
-    id serial NOT NULL,
122
-    product_id integer NOT NULL,
123
-    hex character varying(255) NOT NULL,
124
-    bin bytea NOT NULL
125
-);
126
-
127
---
128
---
129
-
130
-INSERT INTO "categories" ("name", "icon") VALUES
131
-('announcement',	NULL),
132
-('article',	NULL);
133
-
134
---
135
---
136
-
137
-INSERT INTO "comments" ("post_id", "message") VALUES
138
-(1,	'great'),
139
-(1,	'fantastic'),
140
-(2,	'thank you'),
141
-(2,	'awesome');
142
-
143
---
144
---
145
-
146
-INSERT INTO "post_tags" ("post_id", "tag_id") VALUES
147
-(1,	1),
148
-(1,	2),
149
-(2,	1),
150
-(2,	2);
151
-
152
---
153
---
154
-
155
-INSERT INTO "posts" ("user_id", "category_id", "content") VALUES
156
-(1,	1,	'blog started'),
157
-(1,	2,	'It works!');
158
-
159
---
160
---
161
-
162
-INSERT INTO "tags" ("name") VALUES
163
-('funny'),
164
-('important');
165
-
166
---
167
---
168
-
169
-INSERT INTO "users" ("username", "password", "location") VALUES
170
-('user1',	'pass1',	NULL),
171
-('user2',	'pass2',	NULL);
172
-
173
---
174
---
175
-
176
-INSERT INTO "events" ("name", "datetime", "visitors") VALUES
177
-('Launch',	'2016-01-01 13:01:01',	0);
178
-
179
---
180
---
181
-
182
-INSERT INTO "products" ("name", "price", "properties", "created_at") VALUES
183
-('Calculator',	'23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01');
184
-
185
---
186
---
187
-
188
-INSERT INTO "barcodes" ("product_id", "hex", "bin") VALUES
189
-(1,	'00ff01', E'\\x00ff01');
190
-
191
---
192
---
193
-
194
-ALTER TABLE ONLY categories
195
-    ADD CONSTRAINT categories_pkey PRIMARY KEY (id);
196
-
197
-
198
---
199
---
200
-
201
-ALTER TABLE ONLY comments
202
-    ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
203
-
204
-
205
---
206
---
207
-
208
-ALTER TABLE ONLY post_tags
209
-    ADD CONSTRAINT post_tags_pkey PRIMARY KEY (id);
210
-
211
-
212
---
213
---
214
-
215
-ALTER TABLE ONLY post_tags
216
-    ADD CONSTRAINT post_tags_post_id_tag_id_key UNIQUE (post_id, tag_id);
217
-
218
-
219
---
220
---
221
-
222
-ALTER TABLE ONLY posts
223
-    ADD CONSTRAINT posts_pkey PRIMARY KEY (id);
224
-
225
-
226
---
227
---
228
-
229
-ALTER TABLE ONLY tags
230
-    ADD CONSTRAINT tags_pkey PRIMARY KEY (id);
231
-
232
-
233
---
234
---
235
-
236
-ALTER TABLE ONLY users
237
-    ADD CONSTRAINT users_pkey PRIMARY KEY (id);
238
-
239
---
240
---
241
-
242
-ALTER TABLE ONLY events
243
-    ADD CONSTRAINT events_pkey PRIMARY KEY (id);
244
-
245
-
246
---
247
---
248
-
249
-ALTER TABLE ONLY products
250
-    ADD CONSTRAINT products_pkey PRIMARY KEY (id);
251
-
252
-
253
---
254
---
255
-
256
-ALTER TABLE ONLY barcodes
257
-    ADD CONSTRAINT barcodes_pkey PRIMARY KEY (id);
258
-
259
-
260
---
261
---
262
-
263
-CREATE INDEX comments_post_id_idx ON comments USING btree (post_id);
264
-
265
-
266
---
267
---
268
-
269
-CREATE INDEX post_tags_post_id_idx ON post_tags USING btree (post_id);
270
-
271
-
272
---
273
---
274
-
275
-CREATE INDEX post_tags_tag_id_idx ON post_tags USING btree (tag_id);
276
-
277
-
278
---
279
---
280
-
281
-CREATE INDEX posts_category_id_idx ON posts USING btree (category_id);
282
-
283
-
284
---
285
---
286
-
287
-CREATE INDEX posts_user_id_idx ON posts USING btree (user_id);
288
-
289
-
290
---
291
---
292
-
293
-CREATE INDEX barcodes_product_id_idx ON barcodes USING btree (product_id);
294
-
295
-
296
---
297
---
298
-
299
-ALTER TABLE ONLY comments
300
-    ADD CONSTRAINT comments_post_id_fkey FOREIGN KEY (post_id) REFERENCES posts(id);
301
-
302
-
303
---
304
---
305
-
306
-ALTER TABLE ONLY post_tags
307
-    ADD CONSTRAINT post_tags_post_id_fkey FOREIGN KEY (post_id) REFERENCES posts(id);
308
-
309
-
310
---
311
---
312
-
313
-ALTER TABLE ONLY post_tags
314
-    ADD CONSTRAINT post_tags_tag_id_fkey FOREIGN KEY (tag_id) REFERENCES tags(id);
315
-
316
-
317
---
318
---
319
-
320
-ALTER TABLE ONLY posts
321
-    ADD CONSTRAINT posts_category_id_fkey FOREIGN KEY (category_id) REFERENCES categories(id);
322
-
323
-
324
---
325
---
326
-
327
-ALTER TABLE ONLY posts
328
-    ADD CONSTRAINT posts_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
329
-
330
-
331
---
332
---
333
-
334
-ALTER TABLE ONLY barcodes
335
-    ADD CONSTRAINT barcodes_product_id_fkey FOREIGN KEY (product_id) REFERENCES products(id);
336
-
337
-
338
---
339
---

+ 0
- 368
tests/data/blog_postgresql_92_gis.sql View File

@@ -1,416 +0,0 @@
1
---
2
---
3
-
4
-SET statement_timeout = 0;
5
-SET client_encoding = 'UTF8';
6
-SET standard_conforming_strings = on;
7
-SET check_function_bodies = false;
8
-SET client_min_messages = warning;
9
-
10
-SET search_path = public, pg_catalog;
11
-
12
-SET default_tablespace = '';
13
-
14
-SET default_with_oids = false;
15
-
16
---
17
---
18
-
19
-DROP TABLE IF EXISTS categories CASCADE;
20
-DROP TABLE IF EXISTS comments CASCADE;
21
-DROP TABLE IF EXISTS post_tags CASCADE;
22
-DROP TABLE IF EXISTS posts CASCADE;
23
-DROP TABLE IF EXISTS tags CASCADE;
24
-DROP TABLE IF EXISTS users CASCADE;
25
-DROP TABLE IF EXISTS countries CASCADE;
26
-DROP TABLE IF EXISTS events CASCADE;
27
-DROP VIEW IF EXISTS tag_usage;
28
-DROP TABLE IF EXISTS products CASCADE;
29
-DROP TABLE IF EXISTS barcodes CASCADE;
30
-
31
---
32
---
33
-
34
-CREATE EXTENSION IF NOT EXISTS postgis;
35
-
36
---
37
---
38
-
39
-CREATE TABLE categories (
40
-    id serial NOT NULL,
41
-    name character varying(255) NOT NULL,
42
-    icon bytea
43
-);
44
-
45
-
46
---
47
---
48
-
49
-CREATE TABLE comments (
50
-    id serial NOT NULL,
51
-    post_id integer NOT NULL,
52
-    message character varying(255) NOT NULL
53
-);
54
-
55
-
56
---
57
---
58
-
59
-CREATE TABLE post_tags (
60
-    id serial NOT NULL,
61
-    post_id integer NOT NULL,
62
-    tag_id integer NOT NULL
63
-);
64
-
65
-
66
---
67
---
68
-
69
-CREATE TABLE posts (
70
-    id serial NOT NULL,
71
-    user_id integer NOT NULL,
72
-    category_id integer NOT NULL,
73
-    content character varying(255) NOT NULL
74
-);
75
-
76
-
77
---
78
---
79
-
80
-CREATE TABLE tags (
81
-    id serial NOT NULL,
82
-    name character varying(255) NOT NULL
83
-);
84
-
85
-
86
---
87
---
88
-
89
-CREATE TABLE users (
90
-    id serial NOT NULL,
91
-    username character varying(255) NOT NULL,
92
-    password character varying(255) NOT NULL,
93
-    location geometry NULL
94
-);
95
-
96
---
97
---
98
-
99
-CREATE TABLE countries (
100
-    id serial NOT NULL,
101
-    name character varying(255) NOT NULL,
102
-    shape geometry NOT NULL
103
-);
104
-
105
---
106
---
107
-
108
-CREATE TABLE events (
109
-    id serial NOT NULL,
110
-    name character varying(255) NOT NULL,
111
-    datetime timestamp NOT NULL,
112
-    visitors integer NOT NULL
113
-);
114
-
115
---
116
---
117
-
118
-CREATE VIEW "tag_usage" AS select "name", count("name") AS "count" from "tags", "post_tags" where "tags"."id" = "post_tags"."tag_id" group by "name" order by "count" desc, "name";
119
-
120
---
121
---
122
-
123
-CREATE TABLE products (
124
-    id serial NOT NULL,
125
-    name character varying(255) NOT NULL,
126
-    price decimal(10,2) NOT NULL,
127
-    properties json NOT NULL,
128
-    created_at timestamp NOT NULL,
129
-    deleted_at timestamp NULL
130
-);
131
-
132
---
133
---
134
-
135
-CREATE TABLE barcodes (
136
-    id serial NOT NULL,
137
-    product_id integer NOT NULL,
138
-    hex character varying(255) NOT NULL,
139
-    bin bytea NOT NULL
140
-);
141
-
142
---
143
---
144
-
145
-INSERT INTO "categories" ("name", "icon") VALUES
146
-('announcement',	NULL),
147
-('article',	NULL);
148
-
149
---
150
---
151
-
152
-INSERT INTO "comments" ("post_id", "message") VALUES
153
-(1,	'great'),
154
-(1,	'fantastic'),
155
-(2,	'thank you'),
156
-(2,	'awesome');
157
-
158
---
159
---
160
-
161
-INSERT INTO "post_tags" ("post_id", "tag_id") VALUES
162
-(1,	1),
163
-(1,	2),
164
-(2,	1),
165
-(2,	2);
166
-
167
---
168
---
169
-
170
-INSERT INTO "posts" ("user_id", "category_id", "content") VALUES
171
-(1,	1,	'blog started'),
172
-(1,	2,	'It works!');
173
-
174
---
175
---
176
-
177
-INSERT INTO "tags" ("name") VALUES
178
-('funny'),
179
-('important');
180
-
181
---
182
---
183
-
184
-INSERT INTO "users" ("username", "password", "location") VALUES
185
-('user1',	'pass1',	NULL),
186
-('user2',	'pass2',	NULL);
187
-
188
---
189
---
190
-
191
-INSERT INTO "countries" ("name", "shape") VALUES
192
-('Left',	ST_GeomFromText('POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))')),
193
-('Right',	ST_GeomFromText('POLYGON ((70 10, 80 40, 60 40, 50 20, 70 10))'));
194
-
195
---
196
---
197
-
198
-INSERT INTO "events" ("name", "datetime", "visitors") VALUES
199
-('Launch',	'2016-01-01 13:01:01',	0);
200
-
201
---
202
---
203
-
204
-INSERT INTO "products" ("name", "price", "properties", "created_at") VALUES
205
-('Calculator',	'23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01');
206
-
207
---
208
---
209
-
210
-INSERT INTO "barcodes" ("product_id", "hex", "bin") VALUES
211
-(1,	'00ff01', E'\\x00ff01');
212
-
213
---
214
---
215
-
216
-ALTER TABLE ONLY categories
217
-    ADD CONSTRAINT categories_pkey PRIMARY KEY (id);
218
-
219
-
220
---
221
---
222
-
223
-ALTER TABLE ONLY comments
224
-    ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
225
-
226
-
227
---
228
---
229
-
230
-ALTER TABLE ONLY post_tags
231
-    ADD CONSTRAINT post_tags_pkey PRIMARY KEY (id);
232
-
233
-
234
---
235
---
236
-
237
-ALTER TABLE ONLY post_tags
238
-    ADD CONSTRAINT post_tags_post_id_tag_id_key UNIQUE (post_id, tag_id);
239
-
240
-
241
---
242
---
243
-
244
-ALTER TABLE ONLY posts
245
-    ADD CONSTRAINT posts_pkey PRIMARY KEY (id);
246
-
247
-
248
---
249
---
250
-
251
-ALTER TABLE ONLY tags
252
-    ADD CONSTRAINT tags_pkey PRIMARY KEY (id);
253
-
254
-
255
---
256
---
257
-
258
-ALTER TABLE ONLY users
259
-    ADD CONSTRAINT users_pkey PRIMARY KEY (id);
260
-
261
---
262
---
263
-
264
-ALTER TABLE ONLY countries
265
-    ADD CONSTRAINT countries_pkey PRIMARY KEY (id);
266
-
267
-
268
---
269
---
270
-
271
-ALTER TABLE ONLY events
272
-    ADD CONSTRAINT events_pkey PRIMARY KEY (id);
273
-
274
-
275
---
276
---
277
-
278
-ALTER TABLE ONLY products
279
-    ADD CONSTRAINT products_pkey PRIMARY KEY (id);
280
-
281
-
282
---
283
---
284
-
285
-ALTER TABLE ONLY barcodes
286
-    ADD CONSTRAINT barcodes_pkey PRIMARY KEY (id);
287
-
288
-
289
---
290
---
291
-
292
-CREATE INDEX comments_post_id_idx ON comments USING btree (post_id);
293
-
294
-
295
---
296
---
297
-
298
-CREATE INDEX post_tags_post_id_idx ON post_tags USING btree (post_id);
299
-
300
-
301
---
302
---
303
-
304
-CREATE INDEX post_tags_tag_id_idx ON post_tags USING btree (tag_id);
305
-
306
-
307
---
308
---
309
-
310
-CREATE INDEX posts_category_id_idx ON posts USING btree (category_id);
311
-
312
-
313
---
314
---
315
-
316
-CREATE INDEX posts_user_id_idx ON posts USING btree (user_id);
317
-
318
-
319
---
320
---
321
-
322
-CREATE INDEX barcodes_product_id_idx ON barcodes USING btree (product_id);
323
-
324
-
325
---
326
---
327
-
328
-ALTER TABLE ONLY comments
329
-    ADD CONSTRAINT comments_post_id_fkey FOREIGN KEY (post_id) REFERENCES posts(id);
330
-
331
-
332
---
333
---
334
-
335
-ALTER TABLE ONLY post_tags
336
-    ADD CONSTRAINT post_tags_post_id_fkey FOREIGN KEY (post_id) REFERENCES posts(id);
337
-
338
-
339
---
340
---
341
-
342
-ALTER TABLE ONLY post_tags
343
-    ADD CONSTRAINT post_tags_tag_id_fkey FOREIGN KEY (tag_id) REFERENCES tags(id);
344
-
345
-
346
---
347
---
348
-
349
-ALTER TABLE ONLY posts
350
-    ADD CONSTRAINT posts_category_id_fkey FOREIGN KEY (category_id) REFERENCES categories(id);
351
-
352
-
353
---
354
---
355
-
356
-ALTER TABLE ONLY posts
357
-    ADD CONSTRAINT posts_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
358
-
359
-
360
---
361
---
362
-
363
-ALTER TABLE ONLY barcodes
364
-    ADD CONSTRAINT barcodes_product_id_fkey FOREIGN KEY (product_id) REFERENCES products(id);
365
-
366
-
367
---
368
---

+ 0
- 339
tests/data/blog_postgresql_94.sql View File

@@ -1,383 +0,0 @@
1
---
2
---
3
-
4
-SET statement_timeout = 0;
5
-SET client_encoding = 'UTF8';
6
-SET standard_conforming_strings = on;
7
-SET check_function_bodies = false;
8
-SET client_min_messages = warning;
9
-
10
-SET search_path = public, pg_catalog;
11
-
12
-SET default_tablespace = '';
13
-
14
-SET default_with_oids = false;
15
-
16
---
17
---
18
-
19
-DROP TABLE IF EXISTS categories CASCADE;
20
-DROP TABLE IF EXISTS comments CASCADE;
21
-DROP TABLE IF EXISTS post_tags CASCADE;
22
-DROP TABLE IF EXISTS posts CASCADE;
23
-DROP TABLE IF EXISTS tags CASCADE;
24
-DROP TABLE IF EXISTS users CASCADE;
25
-DROP TABLE IF EXISTS events CASCADE;
26
-DROP VIEW IF EXISTS tag_usage;
27
-DROP TABLE IF EXISTS products CASCADE;
28
-DROP TABLE IF EXISTS barcodes CASCADE;
29
-
30
---
31
---
32
-
33
-CREATE TABLE categories (
34
-    id serial NOT NULL,
35
-    name character varying(255) NOT NULL,
36
-    icon bytea
37
-);
38
-
39
-
40
---
41
---
42
-
43
-CREATE TABLE comments (
44
-    id serial NOT NULL,
45
-    post_id integer NOT NULL,
46
-    message character varying(255) NOT NULL
47
-);
48
-
49
-
50
---
51
---
52
-
53
-CREATE TABLE post_tags (
54
-    id serial NOT NULL,
55
-    post_id integer NOT NULL,
56
-    tag_id integer NOT NULL
57
-);
58
-
59
-
60
---
61
---
62
-
63
-CREATE TABLE posts (
64
-    id serial NOT NULL,
65
-    user_id integer NOT NULL,
66
-    category_id integer NOT NULL,
67
-    content character varying(255) NOT NULL
68
-);
69
-
70
-
71
---
72
---
73
-
74
-CREATE TABLE tags (
75
-    id serial NOT NULL,
76
-    name character varying(255) NOT NULL
77
-);
78
-
79
-
80
---
81
---
82
-
83
-CREATE TABLE users (
84
-    id serial NOT NULL,
85
-    username character varying(255) NOT NULL,
86
-    password character varying(255) NOT NULL,
87
-    location text NULL
88
-);
89
-
90
---
91
---
92
-
93
-CREATE TABLE events (
94
-    id serial NOT NULL,
95
-    name character varying(255) NOT NULL,
96
-    datetime timestamp NOT NULL,
97
-    visitors integer NOT NULL
98
-);
99
-
100
---
101
---
102
-
103
-CREATE VIEW "tag_usage" AS select "name", count("name") AS "count" from "tags", "post_tags" where "tags"."id" = "post_tags"."tag_id" group by "name" order by "count" desc, "name";
104
-
105
---
106
---
107
-
108
-CREATE TABLE products (
109
-    id serial NOT NULL,
110
-    name character varying(255) NOT NULL,
111
-    price decimal(10,2) NOT NULL,
112
-    properties jsonb NOT NULL,
113
-    created_at timestamp NOT NULL,
114
-    deleted_at timestamp NULL
115
-);
116
-
117
---
118
---
119
-
120
-CREATE TABLE barcodes (
121
-    id serial NOT NULL,
122
-    product_id integer NOT NULL,
123
-    hex character varying(255) NOT NULL,
124
-    bin bytea NOT NULL
125
-);
126
-
127
---
128
---
129
-
130
-INSERT INTO "categories" ("name", "icon") VALUES
131
-('announcement',	NULL),
132
-('article',	NULL);
133
-
134
---
135
---
136
-
137
-INSERT INTO "comments" ("post_id", "message") VALUES
138
-(1,	'great'),
139
-(1,	'fantastic'),
140
-(2,	'thank you'),
141
-(2,	'awesome');
142
-
143
---
144
---
145
-
146
-INSERT INTO "post_tags" ("post_id", "tag_id") VALUES
147
-(1,	1),
148
-(1,	2),
149
-(2,	1),
150
-(2,	2);
151
-
152
---
153
---
154
-
155
-INSERT INTO "posts" ("user_id", "category_id", "content") VALUES
156
-(1,	1,	'blog started'),
157
-(1,	2,	'It works!');
158
-
159
---
160
---
161
-
162
-INSERT INTO "tags" ("name") VALUES
163
-('funny'),
164
-('important');
165
-
166
---
167
---
168
-
169
-INSERT INTO "users" ("username", "password", "location") VALUES
170
-('user1',	'pass1',	NULL),
171
-('user2',	'pass2',	NULL);
172
-
173
---
174
---
175
-
176
-INSERT INTO "events" ("name", "datetime", "visitors") VALUES
177
-('Launch',	'2016-01-01 13:01:01',	0);
178
-
179
---
180
---
181
-
182
-INSERT INTO "products" ("name", "price", "properties", "created_at") VALUES
183
-('Calculator',	'23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01');
184
-
185
---
186
---
187
-
188
-INSERT INTO "barcodes" ("product_id", "hex", "bin") VALUES
189
-(1,	'00ff01', E'\\x00ff01');
190
-
191
---
192
---
193
-
194
-ALTER TABLE ONLY categories
195
-    ADD CONSTRAINT categories_pkey PRIMARY KEY (id);
196
-
197
-
198
---
199
---
200
-
201
-ALTER TABLE ONLY comments
202
-    ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
203
-
204
-
205
---
206
---
207
-
208
-ALTER TABLE ONLY post_tags
209
-    ADD CONSTRAINT post_tags_pkey PRIMARY KEY (id);
210
-
211
-
212
---
213
---
214
-
215
-ALTER TABLE ONLY post_tags
216
-    ADD CONSTRAINT post_tags_post_id_tag_id_key UNIQUE (post_id, tag_id);
217
-
218
-
219
---
220
---
221
-
222
-ALTER TABLE ONLY posts
223
-    ADD CONSTRAINT posts_pkey PRIMARY KEY (id);
224
-
225
-
226
---
227
---
228
-
229
-ALTER TABLE ONLY tags
230
-    ADD CONSTRAINT tags_pkey PRIMARY KEY (id);
231
-
232
-
233
---
234
---
235
-
236
-ALTER TABLE ONLY users
237
-    ADD CONSTRAINT users_pkey PRIMARY KEY (id);
238
-
239
---
240
---
241
-
242
-ALTER TABLE ONLY events
243
-    ADD CONSTRAINT events_pkey PRIMARY KEY (id);
244
-
245
-
246
---
247
---
248
-
249
-ALTER TABLE ONLY products
250
-    ADD CONSTRAINT products_pkey PRIMARY KEY (id);
251
-
252
-
253
---
254
---
255
-
256
-ALTER TABLE ONLY barcodes
257
-    ADD CONSTRAINT barcodes_pkey PRIMARY KEY (id);
258
-
259
-
260
---
261
---
262
-
263
-CREATE INDEX comments_post_id_idx ON comments USING btree (post_id);
264
-
265
-
266
---
267
---
268
-
269
-CREATE INDEX post_tags_post_id_idx ON post_tags USING btree (post_id);
270
-
271
-
272
---
273
---
274
-
275
-CREATE INDEX post_tags_tag_id_idx ON post_tags USING btree (tag_id);
276
-
277
-
278
---
279
---
280
-
281
-CREATE INDEX posts_category_id_idx ON posts USING btree (category_id);
282
-
283
-
284
---
285
---
286
-
287
-CREATE INDEX posts_user_id_idx ON posts USING btree (user_id);
288
-
289
-
290
---
291
---
292
-
293
-CREATE INDEX barcodes_product_id_idx ON barcodes USING btree (product_id);
294
-
295
-
296
---
297
---
298
-
299
-ALTER TABLE ONLY comments
300
-    ADD CONSTRAINT comments_post_id_fkey FOREIGN KEY (post_id) REFERENCES posts(id);
301
-
302
-
303
---
304
---
305
-
306
-ALTER TABLE ONLY post_tags
307
-    ADD CONSTRAINT post_tags_post_id_fkey FOREIGN KEY (post_id) REFERENCES posts(id);
308
-
309
-
310
---
311
---
312
-
313
-ALTER TABLE ONLY post_tags
314
-    ADD CONSTRAINT post_tags_tag_id_fkey FOREIGN KEY (tag_id) REFERENCES tags(id);
315
-
316
-
317
---
318
---
319
-
320
-ALTER TABLE ONLY posts
321
-    ADD CONSTRAINT posts_category_id_fkey FOREIGN KEY (category_id) REFERENCES categories(id);
322
-
323
-
324
---
325
---
326
-
327
-ALTER TABLE ONLY posts
328
-    ADD CONSTRAINT posts_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
329
-
330
-
331
---
332
---
333
-
334
-ALTER TABLE ONLY barcodes
335
-    ADD CONSTRAINT barcodes_product_id_fkey FOREIGN KEY (product_id) REFERENCES products(id);
336
-
337
-
338
---
339
---

Loading…
Cancel
Save