Redmage/db/migrations/20240409221254_create_table_device.sql

30 lines
871 B
MySQL
Raw Normal View History

2024-04-09 22:37:26 +07:00
-- +goose Up
-- +goose StatementBegin
CREATE TABLE devices(
id INTEGER PRIMARY KEY,
2024-04-26 22:13:04 +07:00
enable INTEGER NOT NULL DEFAULT 1,
2024-04-14 17:30:04 +07:00
slug VARCHAR(255) NOT NULL,
2024-04-09 22:37:26 +07:00
name VARCHAR(255) NOT NULL,
resolution_x DOUBLE NOT NULL,
resolution_y DOUBLE NOT NULL,
aspect_ratio_tolerance DOUBLE NOT NULL default 0.2,
min_x INTEGER NOT NULL DEFAULT 0,
min_y INTEGER NOT NULL DEFAULT 0,
max_x INTEGER NOT NULL DEFAULT 0,
max_y INTEGER NOT NULL DEFAULT 0,
nsfw INTEGER NOT NULL DEFAULT 0,
2024-04-14 00:32:55 +07:00
windows_wallpaper_mode INTEGER NOT NULL DEFAULT 0,
created_at BIGINT DEFAULT 0 NOT NULL,
updated_at BIGINT DEFAULT 0 NOT NULL
2024-04-09 22:37:26 +07:00
);
2024-04-14 17:30:04 +07:00
CREATE UNIQUE INDEX idx_devices_name ON devices(slug);
2024-04-09 22:37:26 +07:00
2024-04-26 22:13:04 +07:00
CREATE INDEX idx_devices_enable ON devices(enable);
2024-04-09 22:37:26 +07:00
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS devices;
-- +goose StatementEnd