diff --git a/migrations/dev/000001_create_channels_table.down.sql b/migrations/dev/000001_create_channels_table.down.sql deleted file mode 100644 index 1d2529d..0000000 --- a/migrations/dev/000001_create_channels_table.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE IF EXISTS channels; diff --git a/migrations/dev/000001_create_channels_table.up.sql b/migrations/dev/000001_create_channels_table.up.sql deleted file mode 100644 index 77fbde7..0000000 --- a/migrations/dev/000001_create_channels_table.up.sql +++ /dev/null @@ -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'); - diff --git a/migrations/dev/000002_create_users_table.down.sql b/migrations/dev/000002_create_users_table.down.sql deleted file mode 100644 index c99ddcd..0000000 --- a/migrations/dev/000002_create_users_table.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE IF EXISTS users; diff --git a/migrations/dev/000002_create_users_table.up.sql b/migrations/dev/000002_create_users_table.up.sql deleted file mode 100644 index 3790b6d..0000000 --- a/migrations/dev/000002_create_users_table.up.sql +++ /dev/null @@ -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,'',''); diff --git a/migrations/dev/000003_create_commands_table.down.sql b/migrations/dev/000003_create_commands_table.down.sql deleted file mode 100644 index fe4f497..0000000 --- a/migrations/dev/000003_create_commands_table.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE IF EXISTS commands; diff --git a/migrations/dev/000003_create_commands_table.up.sql b/migrations/dev/000003_create_commands_table.up.sql deleted file mode 100644 index 1862b43..0000000 --- a/migrations/dev/000003_create_commands_table.up.sql +++ /dev/null @@ -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'); - diff --git a/migrations/dev/000004_create_timers_table.down.sql b/migrations/dev/000004_create_timers_table.down.sql deleted file mode 100644 index 00685d5..0000000 --- a/migrations/dev/000004_create_timers_table.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE IF EXISTS timers; diff --git a/migrations/dev/000004_create_timers_table.up.sql b/migrations/dev/000004_create_timers_table.up.sql deleted file mode 100644 index 796e19c..0000000 --- a/migrations/dev/000004_create_timers_table.up.sql +++ /dev/null @@ -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'); - diff --git a/migrations/dev/000005_create_uploads_table.down.sql b/migrations/dev/000005_create_uploads_table.down.sql deleted file mode 100644 index 281baa8..0000000 --- a/migrations/dev/000005_create_uploads_table.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE IF EXISTS uploads; diff --git a/migrations/dev/000005_create_uploads_table.up.sql b/migrations/dev/000005_create_uploads_table.up.sql deleted file mode 100644 index 7064fe5..0000000 --- a/migrations/dev/000005_create_uploads_table.up.sql +++ /dev/null @@ -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'); - diff --git a/migrations/dev/000006_create_command_logs_table.down.sql b/migrations/dev/000006_create_command_logs_table.down.sql deleted file mode 100644 index dddff0a..0000000 --- a/migrations/dev/000006_create_command_logs_table.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE IF EXISTS commands_logs; diff --git a/migrations/dev/000006_create_command_logs_table.up.sql b/migrations/dev/000006_create_command_logs_table.up.sql deleted file mode 100644 index fa45b7d..0000000 --- a/migrations/dev/000006_create_command_logs_table.up.sql +++ /dev/null @@ -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'); - diff --git a/migrations/dev/000007_create_sent_messages_logs_table.down.sql b/migrations/dev/000007_create_sent_messages_logs_table.down.sql deleted file mode 100644 index e0861b5..0000000 --- a/migrations/dev/000007_create_sent_messages_logs_table.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE IF EXISTS sent_messages_logs; diff --git a/migrations/dev/000007_create_sent_messages_logs_table.up.sql b/migrations/dev/000007_create_sent_messages_logs_table.up.sql deleted file mode 100644 index 22a8723..0000000 --- a/migrations/dev/000007_create_sent_messages_logs_table.up.sql +++ /dev/null @@ -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'); diff --git a/migrations/dev/README.md b/migrations/dev/README.md deleted file mode 100644 index 5760832..0000000 --- a/migrations/dev/README.md +++ /dev/null @@ -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 -``` \ No newline at end of file