mirror of
https://github.com/jkaninda/mysql-bkup.git
synced 2025-12-07 22:19:42 +01:00
ci: add Docker tests (#179)
This commit is contained in:
35
migrations/init.sql
Normal file
35
migrations/init.sql
Normal file
@@ -0,0 +1,35 @@
|
||||
-- Create the database testdb2 and testdb3
|
||||
CREATE DATABASE IF NOT EXISTS testdb2;
|
||||
CREATE DATABASE IF NOT EXISTS testdb3;
|
||||
CREATE DATABASE IF NOT EXISTS fakedb;
|
||||
USE testdb;
|
||||
|
||||
-- Create the 'users' table
|
||||
CREATE TABLE users (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(100) NOT NULL,
|
||||
email VARCHAR(100) NOT NULL UNIQUE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Create the 'orders' table
|
||||
CREATE TABLE orders (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
user_id INT NOT NULL,
|
||||
amount DECIMAL(10,2) NOT NULL,
|
||||
status ENUM('pending', 'completed', 'canceled') NOT NULL DEFAULT 'pending',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Insert fake users
|
||||
INSERT INTO users (name, email) VALUES
|
||||
('Alice Smith', 'alice@example.com'),
|
||||
('Bob Johnson', 'bob@example.com'),
|
||||
('Charlie Brown', 'charlie@example.com');
|
||||
|
||||
-- Insert fake orders
|
||||
INSERT INTO orders (user_id, amount, status) VALUES
|
||||
(1, 100.50, 'completed'),
|
||||
(2, 200.75, 'pending'),
|
||||
(3, 50.00, 'canceled');
|
||||
13
migrations/test_config.yaml
Normal file
13
migrations/test_config.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
#cronExpression: "@every 20s"
|
||||
#backupRescueMode: false
|
||||
databases:
|
||||
- host: 127.0.0.1
|
||||
port: 3306
|
||||
name: testdb
|
||||
user: user
|
||||
password: password
|
||||
- name: testdb2
|
||||
# database credentials from environment variables
|
||||
#TESTDB2_DB_USERNAME
|
||||
#TESTDB2_DB_PASSWORD
|
||||
#TESTDB2_DB_HOST
|
||||
Reference in New Issue
Block a user