refactor: rm other sql
This commit is contained in:
parent
b48e989e9e
commit
3cf551c2c0
|
@ -37,7 +37,7 @@ func ConnectToSqlite() (*gorm.DB, error) {
|
|||
// migrate data
|
||||
if os.Getenv("ENV") != "prod" {
|
||||
go func() {
|
||||
sql, err := os.ReadFile("scripts/sqliteMigrations.sql")
|
||||
sql, err := os.ReadFile("scripts/migrations.sql")
|
||||
if err != nil {
|
||||
//panic("failed to read migration sql file: " + err.Error())
|
||||
log.Fatal("failed to read migration sql file: " + err.Error())
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
DROP DATABASE IF EXISTS bill;
|
||||
CREATE DATABASE IF NOT EXISTS bill;
|
||||
USE bill;
|
||||
|
||||
create table Bills
|
||||
(
|
||||
id int auto_increment primary key,
|
||||
type varchar(15) not null,
|
||||
date varchar(15) not null,
|
||||
money varchar(900) null,
|
||||
cls varchar(900) null,
|
||||
label varchar(900) null,
|
||||
options varchar(900) null
|
||||
);
|
||||
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3341, 'INCOME', '2022-09-01', '8.5', '交通', '打的', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3342, 'INCOME', '2022-09-01', '2.0', '交通', '公交', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3343, 'INCOME', '2022-09-01', '43.0', '交通', '其他', '巴士 回房县');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3344, 'INCOME', '2022-09-01', '5.0', '餐饮', '饮料', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3345, 'INCOME', '2022-09-01', '4.0', '交通', '公交', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3346, 'INCOME', '2022-09-04', '168.0', '餐饮', '聚餐', '胖嫂烧烤');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3347, 'INCOME', '2022-09-03', '27.0', '餐饮', '零食', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3348, 'INCOME', '2022-09-06', '186.0', '交通', '高铁', '回武汉的高铁票');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3349, 'INCOME', '2022-09-06', '4.0', '餐饮', '饮料', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3350, 'INCOME', '2022-09-06', '5.0', '餐饮', '早餐', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3351, 'INCOME', '2022-07-04', '17.9', '餐饮', '晚餐', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3352, 'INCOME', '2022-07-04', '18.5', '餐饮', '午餐', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3353, 'INCOME', '2022-07-04', '9.0', '餐饮', '饮料', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3354, 'INCOME', '2022-07-04', '17.0', '餐饮', '早餐', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3355, 'INCOME', '2022-07-04', '10.3', '餐饮', '零食', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3356, 'INCOME', '2022-07-05', '9.5', '餐饮', '早餐', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3357, 'INCOME', '2022-07-05', '22.0', '餐饮', '午餐', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3358, 'INCOME', '2022-07-05', '16.0', '餐饮', '晚餐', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3359, 'INCOME', '2022-07-05', '1.6', '交通', '公交', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3360, 'INCOME', '2022-07-06', '7.0', '餐饮', '早餐', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3361, 'INCOME', '2022-07-06', '19.0', '餐饮', '午餐', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3362, 'INCOME', '2022-07-06', '6.0', '餐饮', '饮料', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3363, 'INCOME', '2022-07-06', '14.0', '餐饮', '晚餐', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3364, 'INCOME', '2022-07-06', '1.6', '交通', '公交', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3365, 'INCOME', '2022-07-06', '1.6', '交通', '公交', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3366, 'INCOME', '2022-07-06', '16.0', '餐饮', '奶茶', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3367, 'INCOME', '2022-07-07', '9.0', '餐饮', '早餐', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3368, 'INCOME', '2022-07-07', '14.4', '餐饮', '午餐', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3369, 'INCOME', '2022-07-07', '1.6', '交通', '公交', '');
|
||||
INSERT INTO bill.Bills (id, type, date, money, cls, label, options)
|
||||
VALUES (3370, 'INCOME', '2022-07-07', '9.0', '餐饮', '晚餐', '');
|
|
@ -1,46 +1,16 @@
|
|||
-- In this script, 'dmca' stands for 'Docker MariaDB Clean Arch'.
|
||||
DROP DATABASE IF EXISTS fiber_dmca;
|
||||
CREATE DATABASE IF NOT EXISTS fiber_dmca;
|
||||
USE fiber_dmca;
|
||||
INSERT INTO labels (id, type, name, count)
|
||||
VALUES (1, '', 'bill', 0),
|
||||
(2, '', 'bill', 0),
|
||||
(3, '', 'bill', 0),
|
||||
(4, '', 'bill', 0),
|
||||
(5, '', 'bill', 0),
|
||||
(6, '', 'bill', 0),
|
||||
(7, '', 'bill', 0);
|
||||
|
||||
-- Create a sample table.
|
||||
CREATE TABLE users (
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
address VARCHAR(255) NOT NULL,
|
||||
created VARCHAR(255) NOT NULL,
|
||||
modified VARCHAR(255) NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB CHARACTER SET utf8;
|
||||
|
||||
-- Populate table with 10 users.
|
||||
INSERT INTO users VALUES
|
||||
(1, 'Sayu Ogiwara', 'Hokkaido, Japan', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(2, 'Chizuru Ichinose', 'Tokyo, Japan', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(3, 'Asagi Aiba', 'Kyoto, Japan', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(4, 'Rin Tohsaka', 'Kobe, Japan', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(5, 'Mai Sakurajima', 'Fujisawa, Japan', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(6, 'Aki Adagaki', 'Fukuoka, Japan', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(7, 'Asuna Yuuki', 'Shinagawa, Japan', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(8, 'Ruka Sarashina', 'Gotenba, Japan', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(9, 'Miyuki Shiba', 'Nagano, Japan', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(10, 'Fumino Furuhashi', 'Niigata, Japan', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- Create another sample table.
|
||||
CREATE TABLE cities (
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
created VARCHAR(255) NOT NULL,
|
||||
modified VARCHAR(255) NOT NULL,
|
||||
user INT NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
FOREIGN KEY (user) REFERENCES users (id)
|
||||
) ENGINE=InnoDB CHARACTER SET utf8;
|
||||
|
||||
-- Create five data samples.
|
||||
INSERT INTO cities VALUES
|
||||
(1, 'Hokkaido', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 1),
|
||||
(2, 'Tokyo', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 1),
|
||||
(3, 'Kyoto', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 1),
|
||||
(4, 'Osaka', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 2),
|
||||
(5, 'Fukuoka', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 3);
|
||||
INSERT INTO bills (year, month, day, money, label)
|
||||
VALUES (2023, 5, 27, 55, "餐饮"),
|
||||
(2023, 5, 27, 55, "餐饮"),
|
||||
(2023, 5, 30, 51, "生活"),
|
||||
(2023, 5, 30, 51, "生活"),
|
||||
(2023, 5, 30, 51, "生活"),
|
||||
(2023, 5, 30, 52, "餐饮");
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
INSERT INTO labels (id, type, name, count)
|
||||
VALUES (1, '', 'bill', 0),
|
||||
(2, '', 'bill', 0),
|
||||
(3, '', 'bill', 0),
|
||||
(4, '', 'bill', 0),
|
||||
(5, '', 'bill', 0),
|
||||
(6, '', 'bill', 0),
|
||||
(7, '', 'bill', 0);
|
||||
|
||||
INSERT INTO bills (year, month, day, money, label)
|
||||
VALUES (2023, 5, 27, 55, "餐饮"),
|
||||
(2023, 5, 27, 55, "餐饮"),
|
||||
(2023, 5, 30, 51, "生活"),
|
||||
(2023, 5, 30, 51, "生活"),
|
||||
(2023, 5, 30, 51, "生活"),
|
||||
(2023, 5, 30, 52, "餐饮");
|
Loading…
Reference in New Issue
Block a user