Skip to content

Commit

Permalink
Set up yoyo migrations system.
Browse files Browse the repository at this point in the history
  • Loading branch information
emmiegit committed Jan 13, 2024
1 parent 82de2ee commit 9f04bbd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ A new comprehensive backup system for Wikidot, maintained by the SCP-EN Technica

This program is written for Python 3.11 or later. You will need a Wikidot API key, which you can get if you have a [Pro Plan](https://www.wikidot.com/plans).

### Configuration

The `.env` file is sourced by the process to pull in secrets. Look at `.env.example` for the expected structure of this file. These secrets can also be set in the environment directly.

Within `yoyo.ini`, override the database URL with the value of `$POSTGRES_DATABASE_URL`.

### Setup

Create a Python virtual environment, and then install this project's dependencies:
Expand Down
12 changes: 12 additions & 0 deletions migrations/20240112_01_Njk7j-site.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Create initial tables.
-- depends:

CREATE TABLE site (
slug TEXT PRIMARY KEY,
wikidot_id INTEGER NOT NULL,
home_slug TEXT NOT NULL,
domain TEXT NOT NULL,
language TEXT NOT NULL,

UNIQUE (wikidot_id)
);
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pugsql>=0.2.4
python-dotenv>=1.0
requests>=2.31
types-requests>=2.31.0.0
yoyo-migrations>=8.0
5 changes: 5 additions & 0 deletions yoyo.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[DEFAULT]
sources = migrations
database = postgres://localhost
batch_mode = off
verbosity = 0

0 comments on commit 9f04bbd

Please sign in to comment.