Skip to content

Commit

Permalink
Merge pull request #222 from ZVanoZ/2.14.x.zvanoz-fixtures
Browse files Browse the repository at this point in the history
MySQL and MSQL fixtures now recreate test structure.
  • Loading branch information
Xerkus authored Feb 1, 2024
2 parents a0a1eb4 + 58f6853 commit 7e1bbe4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
9 changes: 7 additions & 2 deletions test/integration/TestFixtures/mysql.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CREATE TABLE IF NOT EXISTS test (
DROP TABLE IF EXISTS test;
CREATE TABLE test (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
value VARCHAR(255) NOT NULL,
Expand All @@ -11,7 +12,8 @@ INSERT INTO test (name, value) VALUES
('123a', 'bar'),
('123', 'bar');

CREATE TABLE IF NOT EXISTS test_charset (
DROP TABLE IF EXISTS test_charset;
CREATE TABLE test_charset (
id INT NOT NULL AUTO_INCREMENT,
field$ VARCHAR(255) NOT NULL,
field_ VARCHAR(255) NOT NULL,
Expand All @@ -22,6 +24,7 @@ INSERT INTO test_charset (field$, field_) VALUES
('foo', 'bar'),
('bar', 'baz');

DROP TABLE IF EXISTS test_audit_trail;
CREATE TABLE test_audit_trail (
id INT NOT NULL AUTO_INCREMENT,
test_id INT NOT NULL,
Expand All @@ -31,6 +34,7 @@ CREATE TABLE test_audit_trail (
PRIMARY KEY (id)
);

DROP VIEW IF EXISTS test_view;
CREATE VIEW test_view
AS
SELECT
Expand All @@ -39,6 +43,7 @@ SELECT
FROM
test;

DROP TRIGGER IF EXISTS after_test_update;
CREATE TRIGGER after_test_update
AFTER UPDATE ON test
FOR EACH ROW
Expand Down
2 changes: 1 addition & 1 deletion test/integration/TestFixtures/sqlsrv-triggers.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TRIGGER after_test_update ON test
CREATE OR ALTER TRIGGER after_test_update ON test
AFTER UPDATE
AS
BEGIN
Expand Down
2 changes: 1 addition & 1 deletion test/integration/TestFixtures/sqlsrv-views.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE VIEW test_view
CREATE OR ALTER VIEW test_view
AS (
SELECT
name AS v_name,
Expand Down
3 changes: 3 additions & 0 deletions test/integration/TestFixtures/sqlsrv.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
DROP TABLE IF EXISTS test;
CREATE TABLE test (
id INT NOT NULL IDENTITY,
name VARCHAR(255) NOT NULL,
Expand All @@ -11,6 +12,7 @@ INSERT INTO test (name, value) VALUES
('123a', 'bar'),
('123', 'bar');

DROP TABLE IF EXISTS test_charset;
CREATE TABLE test_charset (
id INT NOT NULL IDENTITY,
field$ VARCHAR(255) NOT NULL,
Expand All @@ -22,6 +24,7 @@ INSERT INTO test_charset (field$, field_) VALUES
('foo', 'bar'),
('bar', 'baz');

DROP TABLE IF EXISTS test_audit_trail
CREATE TABLE test_audit_trail (
id INT NOT NULL IDENTITY,
test_id INT NOT NULL,
Expand Down

0 comments on commit 7e1bbe4

Please sign in to comment.