Browse Source

Merge pull request #244 from karllhughes/master

Making mysql and postgres test suites adaptable
Maurits van der Schee 7 years ago
parent
commit
4a517b9fa4

+ 117
- 1
tests/MysqlTest.php View File

@@ -79,7 +79,6 @@ class MysqlTest extends Tests
79 79
     public function seedDatabase($db, $capabilities)
80 80
     {
81 81
         $fixture = __DIR__.'/data/blog_mysql.sql';
82
-
83 82
         $contents = file_get_contents($fixture);
84 83
 
85 84
         if (!($capabilities & self::GIS)) {
@@ -99,4 +98,121 @@ class MysqlTest extends Tests
99 98
             die("Loading '$fixture' failed on statemement #$i with error:\n".mysqli_error($db)."\n");
100 99
         }
101 100
     }
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
+
102 218
 }

+ 101
- 1
tests/PostgresqlTest.php View File

@@ -95,8 +95,108 @@ class PostgresqlTest extends Tests
95 95
         foreach ($queries as $i=>$query) {
96 96
             if (!pg_query($db, $query.';')) {
97 97
                 $i++;
98
-                die("Loading '$fixture' failed on statemement #$i with error:\n".print_r( pg_last_error($db), true)."\n");
98
+                die("Loading '$seed_file' 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
+
102 202
 }

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

@@ -0,0 +1,148 @@
1
+-- Adminer 4.2.4 MySQL dump
2
+
3
+SET NAMES utf8;
4
+SET time_zone = '+00:00';
5
+SET foreign_key_checks = 0;
6
+SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
7
+
8
+DROP TABLE IF EXISTS `categories`;
9
+CREATE TABLE `categories` (
10
+  `id` int(11) NOT NULL AUTO_INCREMENT,
11
+  `name` varchar(255) NOT NULL,
12
+  `icon` blob NULL,
13
+  PRIMARY KEY (`id`)
14
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
15
+
16
+INSERT INTO `categories` (`id`, `name`, `icon`) VALUES
17
+(1,	'announcement',	NULL),
18
+(2,	'article',	NULL);
19
+
20
+DROP TABLE IF EXISTS `comments`;
21
+CREATE TABLE `comments` (
22
+  `id` int(11) NOT NULL AUTO_INCREMENT,
23
+  `post_id` int(11) NOT NULL,
24
+  `message` varchar(255) NOT NULL,
25
+  PRIMARY KEY (`id`),
26
+  KEY `post_id` (`post_id`),
27
+  CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`)
28
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
29
+
30
+INSERT INTO `comments` (`id`, `post_id`, `message`) VALUES
31
+(1,	1,	'great'),
32
+(2,	1,	'fantastic'),
33
+(3,	2,	'thank you'),
34
+(4,	2,	'awesome');
35
+
36
+DROP TABLE IF EXISTS `posts`;
37
+CREATE TABLE `posts` (
38
+  `id` int(11) NOT NULL AUTO_INCREMENT,
39
+  `user_id` int(11) NOT NULL,
40
+  `category_id` int(11) NOT NULL,
41
+  `content` varchar(255) NOT NULL,
42
+  PRIMARY KEY (`id`),
43
+  KEY `category_id` (`category_id`),
44
+  KEY `user_id` (`user_id`),
45
+  CONSTRAINT `posts_ibfk_3` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`),
46
+  CONSTRAINT `posts_ibfk_4` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
47
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
48
+
49
+INSERT INTO `posts` (`id`, `user_id`, `category_id`, `content`) VALUES
50
+(1,	1,	1,	'blog started'),
51
+(2,	1,	2,	'It works!');
52
+
53
+DROP TABLE IF EXISTS `post_tags`;
54
+CREATE TABLE `post_tags` (
55
+  `id` int(11) NOT NULL AUTO_INCREMENT,
56
+  `post_id` int(11) NOT NULL,
57
+  `tag_id` int(11) NOT NULL,
58
+  PRIMARY KEY (`id`),
59
+  KEY `post_id` (`post_id`),
60
+  KEY `tag_id` (`tag_id`),
61
+  CONSTRAINT `post_tags_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`),
62
+  CONSTRAINT `post_tags_ibfk_2` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`)
63
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
64
+
65
+INSERT INTO `post_tags` (`id`, `post_id`, `tag_id`) VALUES
66
+(1,	1,	1),
67
+(2,	1,	2),
68
+(3,	2,	1),
69
+(4,	2,	2);
70
+
71
+DROP TABLE IF EXISTS `tags`;
72
+CREATE TABLE `tags` (
73
+  `id` int(11) NOT NULL AUTO_INCREMENT,
74
+  `name` varchar(255) NOT NULL,
75
+  PRIMARY KEY (`id`)
76
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
77
+
78
+INSERT INTO `tags` (`id`, `name`) VALUES
79
+(1,	'funny'),
80
+(2,	'important');
81
+
82
+DROP TABLE IF EXISTS `users`;
83
+CREATE TABLE `users` (
84
+  `id` int(11) NOT NULL AUTO_INCREMENT,
85
+  `username` varchar(255) NOT NULL,
86
+  `password` varchar(255) NOT NULL,
87
+  `location` text NULL,
88
+  PRIMARY KEY (`id`)
89
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
90
+
91
+INSERT INTO `users` (`id`, `username`, `password`, `location`) VALUES
92
+(1,	'user1',	'pass1', null),
93
+(2,	'user2',	'pass2', null);
94
+
95
+DROP TABLE IF EXISTS `countries`;
96
+CREATE TABLE `countries` (
97
+  `id` int(11) NOT NULL AUTO_INCREMENT,
98
+  `name` varchar(255) NOT NULL,
99
+  PRIMARY KEY (`id`)
100
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
101
+
102
+INSERT INTO `countries` (`id`, `name`) VALUES
103
+(1,	'Left'),
104
+(2,	'Right');
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
+
148
+-- 2016-11-05 13:11:47

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

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

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


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

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

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

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

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

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

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

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

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

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

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


Loading…
Cancel
Save