Skip to content

Commit 58f6853

Browse files
ZVanoZXerkus
authored andcommitted
MySQL and MSQL fixtures now recreate test structure.
Signed-off-by: ZVanoZ <[email protected]>
1 parent a0a1eb4 commit 58f6853

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

test/integration/TestFixtures/mysql.sql

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
CREATE TABLE IF NOT EXISTS test (
1+
DROP TABLE IF EXISTS test;
2+
CREATE TABLE test (
23
id INT NOT NULL AUTO_INCREMENT,
34
name VARCHAR(255) NOT NULL,
45
value VARCHAR(255) NOT NULL,
@@ -11,7 +12,8 @@ INSERT INTO test (name, value) VALUES
1112
('123a', 'bar'),
1213
('123', 'bar');
1314

14-
CREATE TABLE IF NOT EXISTS test_charset (
15+
DROP TABLE IF EXISTS test_charset;
16+
CREATE TABLE test_charset (
1517
id INT NOT NULL AUTO_INCREMENT,
1618
field$ VARCHAR(255) NOT NULL,
1719
field_ VARCHAR(255) NOT NULL,
@@ -22,6 +24,7 @@ INSERT INTO test_charset (field$, field_) VALUES
2224
('foo', 'bar'),
2325
('bar', 'baz');
2426

27+
DROP TABLE IF EXISTS test_audit_trail;
2528
CREATE TABLE test_audit_trail (
2629
id INT NOT NULL AUTO_INCREMENT,
2730
test_id INT NOT NULL,
@@ -31,6 +34,7 @@ CREATE TABLE test_audit_trail (
3134
PRIMARY KEY (id)
3235
);
3336

37+
DROP VIEW IF EXISTS test_view;
3438
CREATE VIEW test_view
3539
AS
3640
SELECT
@@ -39,6 +43,7 @@ SELECT
3943
FROM
4044
test;
4145

46+
DROP TRIGGER IF EXISTS after_test_update;
4247
CREATE TRIGGER after_test_update
4348
AFTER UPDATE ON test
4449
FOR EACH ROW

test/integration/TestFixtures/sqlsrv-triggers.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CREATE TRIGGER after_test_update ON test
1+
CREATE OR ALTER TRIGGER after_test_update ON test
22
AFTER UPDATE
33
AS
44
BEGIN

test/integration/TestFixtures/sqlsrv-views.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CREATE VIEW test_view
1+
CREATE OR ALTER VIEW test_view
22
AS (
33
SELECT
44
name AS v_name,

test/integration/TestFixtures/sqlsrv.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
DROP TABLE IF EXISTS test;
12
CREATE TABLE test (
23
id INT NOT NULL IDENTITY,
34
name VARCHAR(255) NOT NULL,
@@ -11,6 +12,7 @@ INSERT INTO test (name, value) VALUES
1112
('123a', 'bar'),
1213
('123', 'bar');
1314

15+
DROP TABLE IF EXISTS test_charset;
1416
CREATE TABLE test_charset (
1517
id INT NOT NULL IDENTITY,
1618
field$ VARCHAR(255) NOT NULL,
@@ -22,6 +24,7 @@ INSERT INTO test_charset (field$, field_) VALUES
2224
('foo', 'bar'),
2325
('bar', 'baz');
2426

27+
DROP TABLE IF EXISTS test_audit_trail
2528
CREATE TABLE test_audit_trail (
2629
id INT NOT NULL IDENTITY,
2730
test_id INT NOT NULL,

0 commit comments

Comments
 (0)