mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
remove dev migrations
This commit is contained in:
parent
a542b32b89
commit
59a2cbe80f
15 changed files with 0 additions and 155 deletions
|
@ -1 +0,0 @@
|
||||||
DROP TABLE IF EXISTS channels;
|
|
|
@ -1,13 +0,0 @@
|
||||||
CREATE TABLE IF NOT EXISTS channels (
|
|
||||||
id bigserial PRIMARY KEY,
|
|
||||||
added_at timestamp(0) with time zone NOT NULL DEFAULT NOW(),
|
|
||||||
login text UNIQUE NOT NULL,
|
|
||||||
twitchid text NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO channels (added_at,login,twitchid) VALUES
|
|
||||||
(NOW(),'nouryxd','31437432'),
|
|
||||||
(NOW(),'nourybot','596581605'),
|
|
||||||
(NOW(),'uudelleenkytkeytynyt','465178364'),
|
|
||||||
(NOW(),'xnoury','197780373');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
DROP TABLE IF EXISTS users;
|
|
|
@ -1,15 +0,0 @@
|
||||||
CREATE TABLE IF NOT EXISTS users (
|
|
||||||
id bigserial PRIMARY KEY,
|
|
||||||
added_at timestamp(0) with time zone NOT NULL DEFAULT NOW(),
|
|
||||||
login text UNIQUE NOT NULL,
|
|
||||||
twitchid text NOT NULL,
|
|
||||||
level integer,
|
|
||||||
location text,
|
|
||||||
lastfm_username text
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO users (added_at,login,twitchid,"level",location,lastfm_username) VALUES
|
|
||||||
(NOW(),'nouryxd','31437432',1000,'vilnius','nouryqt'),
|
|
||||||
(NOW(),'nourybot','596581605',1000,'',''),
|
|
||||||
(NOW(),'xnoury','197780373',500,'',''),
|
|
||||||
(NOW(),'uudelleenkytkeytynyt','465178364',1000,'','');
|
|
|
@ -1 +0,0 @@
|
||||||
DROP TABLE IF EXISTS commands;
|
|
|
@ -1,16 +0,0 @@
|
||||||
CREATE TABLE IF NOT EXISTS commands (
|
|
||||||
id bigserial PRIMARY KEY,
|
|
||||||
name text NOT NULL,
|
|
||||||
channel text NOT NULL,
|
|
||||||
text text NOT NULL,
|
|
||||||
level integer NOT NULL,
|
|
||||||
description text NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO commands (name,"channel","text","level","description") VALUES
|
|
||||||
('repeat','nouryxd','xset r rate 175 75',0,'Command to set my keyboard repeat rate'),
|
|
||||||
('xset','nouryxd','xset r rate 175 75',0,'Command to set my keyboard repeat rate'),
|
|
||||||
('kek','nouryxd','lmao',0,'kek'),
|
|
||||||
('lmao','nourybot','kek',0,'lmao'),
|
|
||||||
('dockerclean','nouryxd','docker system prune -a --volumes',0,'clean docker');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
DROP TABLE IF EXISTS timers;
|
|
|
@ -1,13 +0,0 @@
|
||||||
CREATE TABLE IF NOT EXISTS timers (
|
|
||||||
id bigserial PRIMARY KEY,
|
|
||||||
name text NOT NULL,
|
|
||||||
identifier text NOT NULL,
|
|
||||||
text text NOT NULL,
|
|
||||||
channel text NOT NULL,
|
|
||||||
repeat text NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO timers (name,identifier,"text",channel,repeat) VALUES
|
|
||||||
('nourybot-5m','2ad01f96-05d3-444e-9dd6-524d397caa96','5m timer','nourybot','5m'),
|
|
||||||
('nourybot-10m','2ad01f96-05d3-444e-9dd6-524d397caa96','10m timer','nourybot','10m');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
DROP TABLE IF EXISTS uploads;
|
|
|
@ -1,17 +0,0 @@
|
||||||
CREATE TABLE IF NOT EXISTS uploads (
|
|
||||||
id bigserial PRIMARY KEY,
|
|
||||||
added_at timestamp(0) with time zone NOT NULL DEFAULT NOW(),
|
|
||||||
twitchlogin text NOT NULL,
|
|
||||||
twitchid text NOT NULL,
|
|
||||||
twitchmessage text NOT NULL,
|
|
||||||
twitchchannel text NOT NULL,
|
|
||||||
filehoster text NOT NULL,
|
|
||||||
downloadurl text,
|
|
||||||
uploadurl text,
|
|
||||||
identifier text
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO uploads (added_at,twitchlogin,twitchid,twitchchannel,twitchmessage,filehoster,downloadurl,uploadurl,identifier) VALUES
|
|
||||||
(NOW(),'nouryxd','31437432','nouryxd','()yaf https://www.youtube.com/watch?v=3rBFkwtaQbU','yaf','https://www.youtube.com/watch?v=3rBFkwtaQbU','https://i.yaf.li/LEFuX.webm','a4af2284-4e13-46fa-9896-393bb1771a9d'),
|
|
||||||
(NOW(),'uudelleenkytkeytynyt','465178364','nouryxd','()gofile https://www.youtube.com/watch?v=st6yupvNkVo','gofile','https://www.youtube.com/watch?v=st6yupvNkVo','https://gofile.io/d/PD1QNr','4ec952cc-42c0-41cd-9b07-637b4ec3c2b3');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
DROP TABLE IF EXISTS commands_logs;
|
|
|
@ -1,16 +0,0 @@
|
||||||
CREATE TABLE IF NOT EXISTS commands_logs (
|
|
||||||
id bigserial PRIMARY KEY,
|
|
||||||
added_at timestamp(0) with time zone NOT NULL DEFAULT NOW(),
|
|
||||||
twitch_login text NOT NULL,
|
|
||||||
twitch_id text NOT NULL,
|
|
||||||
twitch_channel text NOT NULL,
|
|
||||||
twitch_message text NOT NULL,
|
|
||||||
command_name text NOT NULL,
|
|
||||||
user_level integer NOT NULL,
|
|
||||||
identifier text NOT NULL,
|
|
||||||
raw_message text NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO commands_logs (added_at,twitch_login,twitch_id,twitch_channel,twitch_message,command_name,user_level,identifier,raw_message) VALUES
|
|
||||||
(NOW(),'nouryxd','31437432','nourybot','()weather Vilnius','weather',1000,'8441e97b-f622-4c42-b9b1-9bf22ba0d0bd','@badge-info=;badges=moderator/1,game-developer/1;color=#00F2FB;display-name=nouryxd;emotes=;first-msg=0;flags=;id=87d40f5c-8c7c-4105-9f57-b1a953bb42d0;mod=1;returning-chatter=0;room-id=596581605;subscriber=0;tmi-sent-ts=1696945359165;turbo=0;user-id=31437432;user-type=mod :nouryxd!nouryxd@nouryxd.tmi.twitch.tv PRIVMSG #nourybot :()weather Vilnius');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
DROP TABLE IF EXISTS sent_messages_logs;
|
|
|
@ -1,15 +0,0 @@
|
||||||
CREATE TABLE IF NOT EXISTS sent_messages_logs (
|
|
||||||
id bigserial PRIMARY KEY,
|
|
||||||
added_at timestamp(0) with time zone NOT NULL DEFAULT NOW(),
|
|
||||||
twitch_channel text NOT NULL,
|
|
||||||
twitch_message text NOT NULL,
|
|
||||||
context_command_name text,
|
|
||||||
context_username text,
|
|
||||||
context_message text,
|
|
||||||
context_user_id text,
|
|
||||||
identifier text,
|
|
||||||
context_raw text
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO sent_messages_logs (added_at,twitch_channel,twitch_message,context_command_name,context_username,context_message,context_user_id,identifier,context_raw) VALUES
|
|
||||||
(NOW(),'nourybot','Weather for Vilnius, LT: Feels like: 8.07°C. Currently 8.65°C with a high of 9.29°C and a low of 8.49°C, humidity: 66%, wind: 1.54m/s.','weather','noury','()weather Vilnius','31437432','654f9761-b2d4-4975-a4fd-84c6ec7f2eb8','@badge-info=;badges=moderator/1,game-developer/1;color=#00F2FB;display-name=noury;emotes=;first-msg=0;flags=;id=357d94a4-024e-49ea-ab3d-d97286cd0492;mod=1;returning-chatter=0;room-id=596581605;subscriber=0;tmi-sent-ts=1696952295788;turbo=0;user-id=31437432;user-type=mod :nouryxd!nouryxd@nouryxd.tmi.twitch.tv PRIVMSG #nourybot :()weather Vilnius');
|
|
|
@ -1,43 +0,0 @@
|
||||||
# Migrations
|
|
||||||
|
|
||||||
Tool: [golang-migrate](https://github.com/golang-migrate/migrate/tree/master/cmd/migrate)
|
|
||||||
|
|
||||||
## Create Database
|
|
||||||
```sql
|
|
||||||
$ sudo -u postgres psql
|
|
||||||
psql (14.3)
|
|
||||||
Type "help" for help.
|
|
||||||
|
|
||||||
postgres=# CREATE DATABASE nourybot;
|
|
||||||
CREATE DATABASE
|
|
||||||
postgres=# \c nourybot;
|
|
||||||
You are now connected to database "nourybot" as user "postgres".
|
|
||||||
nourybot=# CREATE ROLE username WITH LOGIN PASSWORD 'password';
|
|
||||||
CREATE ROLE
|
|
||||||
nourybot=# CREATE EXTENSION IF NOT EXISTS citext;
|
|
||||||
CREATE EXTENSION
|
|
||||||
nourybot=#
|
|
||||||
```
|
|
||||||
|
|
||||||
## Connect to Database
|
|
||||||
```sh
|
|
||||||
$ psql --host=localhost --dbname=nourybot --username=username
|
|
||||||
psql (14.3)
|
|
||||||
Type "help" for help.
|
|
||||||
|
|
||||||
nourybot=>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Apply migrations
|
|
||||||
```sh
|
|
||||||
$ migrate -path=./migrations -database="postgres://username:password@localhost/nourybot?sslmode=disable" up
|
|
||||||
```
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ migrate -path=./migrations -database="postgres://username:password@localhost/nourybot?sslmode=disable" down
|
|
||||||
```
|
|
||||||
|
|
||||||
## Fix Dirty database
|
|
||||||
```sh
|
|
||||||
$ migrate -path=./migrations -database="postgres://username:password@localhost/nourybot?sslmode=disable" force 1
|
|
||||||
```
|
|
Loading…
Reference in a new issue