pull/6/head
Yax 3 years ago
parent 325455439a
commit c75fa2f669

@ -1,7 +1,7 @@
[![GitLicense](https://gitlicense.com/badge/kianby/stacosys)](https://gitlicense.com/license/kianby/stacosys) [![GitLicense](https://gitlicense.com/badge/kianby/stacosys)](https://gitlicense.com/license/kianby/stacosys)
[![Python version](https://img.shields.io/badge/Python-3.9-blue.svg)](https://www.python.org/) [![Flask version](https://img.shields.io/badge/Flask-2.0.1-green.svg)](https://flask.palletsprojects.com) [![Peewee version](https://img.shields.io/badge/Peewee-3.14.0-green.svg)](https://docs.peewee-orm.com/) [![Python version](https://img.shields.io/badge/Python-3.9-blue.svg)](https://www.python.org/) [![Flask version](https://img.shields.io/badge/Flask-2.0.1-green.svg)](https://flask.palletsprojects.com) [![Peewee version](https://img.shields.io/badge/Peewee-3.14.0-green.svg)](https://docs.peewee-orm.com/)
[![Build Status - pytest](https://github.com/kianby/stacosys/workflows/pytest/badge.svg)](https://github.com/kianby/stacosys) [![Coverage Status](https://coveralls.io/repos/github/kianby/stacosys/badge.svg?branch=main)](https://coveralls.io/github/kianby/stacosys?branch=main) [![Build status - docker image](https://github.com/kianby/stacosys/workflows/docker/badge.svg)](https://hub.docker.com/r/kianby/stacosys) [![Build Status - pytest](https://github.com/kianby/stacosys/workflows/pytest/badge.svg)](https://github.com/kianby/stacosys) [![Coverage Status](https://coveralls.io/repos/github/kianby/stacosys/badge.svg?branch=main)](https://coveralls.io/github/kianby/stacosys?branch=main) [![Build status - docker image](https://github.com/kianby/stacosys/workflows/docker/badge.svg)](https://hub.docker.com/r/kianby/stacosys) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
## Stacosys ## Stacosys

@ -8,15 +8,15 @@ cursor = connection.cursor()
script = """ script = """
CREATE TABLE comment ( CREATE TABLE comment (
id INTEGER NOT NULL PRIMARY KEY, id INTEGER NOT NULL PRIMARY KEY,
url VARCHAR(255) NOT NULL, url VARCHAR(255) NOT NULL,
notified DATETIME, notified DATETIME,
created DATETIME NOT NULL, created DATETIME NOT NULL,
published DATETIME, published DATETIME,
author_name VARCHAR(255) NOT NULL, author_name VARCHAR(255) NOT NULL,
author_site VARCHAR(255) NOT NULL, author_site VARCHAR(255) NOT NULL,
author_gravatar varchar(255), author_gravatar varchar(255),
content TEXT NOT NULL content TEXT NOT NULL
, ulid INTEGER); , ulid INTEGER);
""" """

@ -8,25 +8,27 @@ cursor = connection.cursor()
# What script performs: # What script performs:
# - first, remove site table: crash here if table doesn't exist (compatibility test without effort) # - first, remove site table: crash here if table doesn't exist (compatibility test without effort)
# - remove site_id colum from comment table # - remove site_id column from comment table
script = """ script = """
PRAGMA foreign_keys = OFF; PRAGMA foreign_keys = OFF;
BEGIN TRANSACTION; BEGIN TRANSACTION;
DROP TABLE site; DROP TABLE site;
ALTER TABLE comment RENAME TO _comment_old; ALTER TABLE comment RENAME TO _comment_old;
CREATE TABLE comment ( CREATE TABLE comment (
id INTEGER NOT NULL PRIMARY KEY, id INTEGER NOT NULL PRIMARY KEY,
url VARCHAR(255) NOT NULL, url VARCHAR(255) NOT NULL,
notified DATETIME, notified DATETIME,
created DATETIME NOT NULL, created DATETIME NOT NULL,
published DATETIME, published DATETIME,
author_name VARCHAR(255) NOT NULL, author_name VARCHAR(255) NOT NULL,
author_site VARCHAR(255) NOT NULL, author_site VARCHAR(255) NOT NULL,
author_gravatar varchar(255), author_gravatar varchar(255),
content TEXT NOT NULL content TEXT NOT NULL
); );
INSERT INTO comment (id, url, notified, created, published, author_name, author_site, author_gravatar, content) INSERT INTO comment (id, url, notified, created, published,
SELECT id, url, notified, created, published, author_name, author_site, author_gravatar, content author_name, author_site, author_gravatar, content)
SELECT id, url, notified, created, published,
author_name, author_site, author_gravatar, content
FROM _comment_old; FROM _comment_old;
DROP TABLE _comment_old; DROP TABLE _comment_old;
COMMIT; COMMIT;

@ -1,5 +1,4 @@
[flake8] [flake8]
max-line-length = 88 max-line-length = 88
extend-ignore = E203 extend-ignore = E203
exclude = */tests/*
spellcheck-targets=comments spellcheck-targets=comments

@ -17,6 +17,7 @@ def init_test_db():
c3 = dao.create_comment("/site3", "Jack", "/jack.site", "", "comment 3") c3 = dao.create_comment("/site3", "Jack", "/jack.site", "", "comment 3")
dao.publish_comment(c1) dao.publish_comment(c1)
dao.publish_comment(c3) dao.publish_comment(c3)
assert c2
@pytest.fixture @pytest.fixture

Loading…
Cancel
Save