summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--python-peewee-migrations.spec593
-rw-r--r--sources1
3 files changed, 595 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..f9a89ec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/peewee-migrations-0.3.32.tar.gz
diff --git a/python-peewee-migrations.spec b/python-peewee-migrations.spec
new file mode 100644
index 0000000..94f44f7
--- /dev/null
+++ b/python-peewee-migrations.spec
@@ -0,0 +1,593 @@
+%global _empty_manifest_terminate_build 0
+Name: python-peewee-migrations
+Version: 0.3.32
+Release: 1
+Summary: Migration engine for peewee orm
+License: LGPL3
+URL: https://github.com/aachurin/peewee_migrations
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/3e/0f/e32c0078061a3454089da61e75addb29288aaa72fd1b5514f0d94ff3dd01/peewee-migrations-0.3.32.tar.gz
+BuildArch: noarch
+
+Requires: python3-peewee
+Requires: python3-click
+
+%description
+# Peewee Migrations
+
+A simple and flexible migration manager for Peewee ORM.
+
+* **Version:** 0.3.32
+* **Status:** Development/Alpha
+* **Author:** Churin Andrey
+
+# Requirements
+
+* python >= 3.5
+* latest peewee
+
+## Note
+SQLite is not supported.
+
+
+## Quick start
+
+This package can be installed using pip:
+
+```bash
+$ pip install peewee-migrations
+```
+
+Run `pem init` in the project root.
+
+```bash
+$ pem init
+Configuration file 'migrations.json' was created.
+```
+
+Suppose we have `Foo` model in `models.py`
+
+```python
+class Foo(db.Model):
+ bar = peewee.CharField(max_length=50)
+ baz = peewee.IntegerField()
+ quux = peewee.IntegerField()
+```
+
+Add this model to the watch list and create migration.
+
+```bash
+$ pem add models.Foo
+Model 'models.Foo' was added to the watch list.
+$ pem watch
+Migration `0001_migration_201807191008` has been created.
+```
+
+Now you can list available migrations:
+
+```bash
+$ pem list
+[ ] 0001_migration_201807191008
+```
+
+Or view SQL that will be executed during migration:
+
+```bash
+$ pem show
+[ ] 0001_migration_201807191008:
+ SQL> CREATE TABLE "foo" ("id" SERIAL NOT NULL PRIMARY KEY, "bar" VARCHAR(50) NOT NULL, "baz" INTEGER NOT NULL, "quux" INTEGER NOT NULL) []
+ PY> set_done('0001_migration_201807191008')
+```
+
+Use `migrate` to run migrations:
+
+```bash
+$ pem migrate
+[X] 0001_migration_201807191008
+```
+
+Change model `Foo`
+
+```python
+class Foo(db.Model):
+ bar = peewee.CharField(max_length=20)
+ baz = peewee.IntegerField()
+ quux = peewee.IntegerField()
+ xyzzy = peewee.IntegerField()
+```
+
+and run `watch` to create new migration:
+
+```bash
+$ pem watch
+Migration `0002_migration_201807191036` has been created.
+$ pem show
+[ ] 0002_migration_201807191036:
+ SQL> ALTER TABLE "foo" ADD COLUMN "xyzzy" INTEGER []
+ SQL> ALTER TABLE "foo" RENAME COLUMN "bar" TO "old__bar" []
+ SQL> ALTER TABLE "foo" ADD COLUMN "bar" VARCHAR(20) []
+ SQL> UPDATE "foo" SET "xyzzy" = %s WHERE ("xyzzy" IS %s) [0, None]
+ SQL> UPDATE "foo" SET "bar" = SUBSTRING("old__bar", %s, %s) WHERE ("old__bar" IS NOT %s) [1, 20, None]
+ SQL> ALTER TABLE "foo" DROP COLUMN "old__bar" []
+ SQL> ALTER TABLE "foo" ALTER COLUMN "xyzzy" SET NOT NULL []
+ SQL> ALTER TABLE "foo" ALTER COLUMN "bar" SET NOT NULL []
+ PY> set_done('0002_migration_201807191036')
+```
+
+It's possible to create "serialized" migrations, run `pem watch --serialize`. In this case, explicit migration functions will be additionally created.
+
+```bash
+$ pem watch --serialize
+Migration `0001_migration_202112161523` has been created.
+```
+
+Additional code will be generated
+
+```python
+...
+
+def migrate_forward(op, old_orm, new_orm):
+ op.create_table(new_orm.foo)
+
+
+def migrate_backward(op, old_orm, new_orm):
+ op.drop_table(old_orm.foo)
+```
+
+And after changing the model
+
+```bash
+$ pem watch --serialize
+Migration `0002_migration_202112161527` has been created.
+```
+
+```python
+...
+
+def migrate_forward(op, old_orm, new_orm):
+ op.add_column(new_orm.foo.xyzzy)
+ op.rename_column(old_orm.foo.bar, 'old__bar')
+ op.add_column(new_orm.foo.bar)
+ op.run_data_migration()
+ op.drop_column(old_orm.foo.bar)
+ op.add_not_null(new_orm.foo.xyzzy)
+ op.add_not_null(new_orm.foo.bar)
+
+
+...
+
+def migrate_backward(op, old_orm, new_orm):
+ op.rename_column(old_orm.foo.bar, 'old__bar')
+ op.add_column(new_orm.foo.bar)
+ op.run_data_migration()
+ op.drop_column(old_orm.foo.xyzzy)
+ op.drop_column(old_orm.foo.bar)
+ op.add_not_null(new_orm.foo.bar)
+
+```
+
+Serialized migrations are performed only according to the operations specified in the migrate functions.
+
+To run migrations without a transaction, use `pem migrate --autocommit`. To view a list of operations that will be performed in this mode, use `pem show --autocommit` (some operations may differ).
+
+For more information on using the commands see --help.
+
+## migrations.json
+```
+{
+ "prerun": "some code here", // some code to run before executing any command
+ "directory": "migrations", // folder to hold migrations
+ "history": "migratehistory", // table to hold migration history
+ "models": [ // list of models to watch
+ "module1.Model1",
+ "module2.Model2"
+ ]
+}
+```
+
+
+
+
+%package -n python3-peewee-migrations
+Summary: Migration engine for peewee orm
+Provides: python-peewee-migrations
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-peewee-migrations
+# Peewee Migrations
+
+A simple and flexible migration manager for Peewee ORM.
+
+* **Version:** 0.3.32
+* **Status:** Development/Alpha
+* **Author:** Churin Andrey
+
+# Requirements
+
+* python >= 3.5
+* latest peewee
+
+## Note
+SQLite is not supported.
+
+
+## Quick start
+
+This package can be installed using pip:
+
+```bash
+$ pip install peewee-migrations
+```
+
+Run `pem init` in the project root.
+
+```bash
+$ pem init
+Configuration file 'migrations.json' was created.
+```
+
+Suppose we have `Foo` model in `models.py`
+
+```python
+class Foo(db.Model):
+ bar = peewee.CharField(max_length=50)
+ baz = peewee.IntegerField()
+ quux = peewee.IntegerField()
+```
+
+Add this model to the watch list and create migration.
+
+```bash
+$ pem add models.Foo
+Model 'models.Foo' was added to the watch list.
+$ pem watch
+Migration `0001_migration_201807191008` has been created.
+```
+
+Now you can list available migrations:
+
+```bash
+$ pem list
+[ ] 0001_migration_201807191008
+```
+
+Or view SQL that will be executed during migration:
+
+```bash
+$ pem show
+[ ] 0001_migration_201807191008:
+ SQL> CREATE TABLE "foo" ("id" SERIAL NOT NULL PRIMARY KEY, "bar" VARCHAR(50) NOT NULL, "baz" INTEGER NOT NULL, "quux" INTEGER NOT NULL) []
+ PY> set_done('0001_migration_201807191008')
+```
+
+Use `migrate` to run migrations:
+
+```bash
+$ pem migrate
+[X] 0001_migration_201807191008
+```
+
+Change model `Foo`
+
+```python
+class Foo(db.Model):
+ bar = peewee.CharField(max_length=20)
+ baz = peewee.IntegerField()
+ quux = peewee.IntegerField()
+ xyzzy = peewee.IntegerField()
+```
+
+and run `watch` to create new migration:
+
+```bash
+$ pem watch
+Migration `0002_migration_201807191036` has been created.
+$ pem show
+[ ] 0002_migration_201807191036:
+ SQL> ALTER TABLE "foo" ADD COLUMN "xyzzy" INTEGER []
+ SQL> ALTER TABLE "foo" RENAME COLUMN "bar" TO "old__bar" []
+ SQL> ALTER TABLE "foo" ADD COLUMN "bar" VARCHAR(20) []
+ SQL> UPDATE "foo" SET "xyzzy" = %s WHERE ("xyzzy" IS %s) [0, None]
+ SQL> UPDATE "foo" SET "bar" = SUBSTRING("old__bar", %s, %s) WHERE ("old__bar" IS NOT %s) [1, 20, None]
+ SQL> ALTER TABLE "foo" DROP COLUMN "old__bar" []
+ SQL> ALTER TABLE "foo" ALTER COLUMN "xyzzy" SET NOT NULL []
+ SQL> ALTER TABLE "foo" ALTER COLUMN "bar" SET NOT NULL []
+ PY> set_done('0002_migration_201807191036')
+```
+
+It's possible to create "serialized" migrations, run `pem watch --serialize`. In this case, explicit migration functions will be additionally created.
+
+```bash
+$ pem watch --serialize
+Migration `0001_migration_202112161523` has been created.
+```
+
+Additional code will be generated
+
+```python
+...
+
+def migrate_forward(op, old_orm, new_orm):
+ op.create_table(new_orm.foo)
+
+
+def migrate_backward(op, old_orm, new_orm):
+ op.drop_table(old_orm.foo)
+```
+
+And after changing the model
+
+```bash
+$ pem watch --serialize
+Migration `0002_migration_202112161527` has been created.
+```
+
+```python
+...
+
+def migrate_forward(op, old_orm, new_orm):
+ op.add_column(new_orm.foo.xyzzy)
+ op.rename_column(old_orm.foo.bar, 'old__bar')
+ op.add_column(new_orm.foo.bar)
+ op.run_data_migration()
+ op.drop_column(old_orm.foo.bar)
+ op.add_not_null(new_orm.foo.xyzzy)
+ op.add_not_null(new_orm.foo.bar)
+
+
+...
+
+def migrate_backward(op, old_orm, new_orm):
+ op.rename_column(old_orm.foo.bar, 'old__bar')
+ op.add_column(new_orm.foo.bar)
+ op.run_data_migration()
+ op.drop_column(old_orm.foo.xyzzy)
+ op.drop_column(old_orm.foo.bar)
+ op.add_not_null(new_orm.foo.bar)
+
+```
+
+Serialized migrations are performed only according to the operations specified in the migrate functions.
+
+To run migrations without a transaction, use `pem migrate --autocommit`. To view a list of operations that will be performed in this mode, use `pem show --autocommit` (some operations may differ).
+
+For more information on using the commands see --help.
+
+## migrations.json
+```
+{
+ "prerun": "some code here", // some code to run before executing any command
+ "directory": "migrations", // folder to hold migrations
+ "history": "migratehistory", // table to hold migration history
+ "models": [ // list of models to watch
+ "module1.Model1",
+ "module2.Model2"
+ ]
+}
+```
+
+
+
+
+%package help
+Summary: Development documents and examples for peewee-migrations
+Provides: python3-peewee-migrations-doc
+%description help
+# Peewee Migrations
+
+A simple and flexible migration manager for Peewee ORM.
+
+* **Version:** 0.3.32
+* **Status:** Development/Alpha
+* **Author:** Churin Andrey
+
+# Requirements
+
+* python >= 3.5
+* latest peewee
+
+## Note
+SQLite is not supported.
+
+
+## Quick start
+
+This package can be installed using pip:
+
+```bash
+$ pip install peewee-migrations
+```
+
+Run `pem init` in the project root.
+
+```bash
+$ pem init
+Configuration file 'migrations.json' was created.
+```
+
+Suppose we have `Foo` model in `models.py`
+
+```python
+class Foo(db.Model):
+ bar = peewee.CharField(max_length=50)
+ baz = peewee.IntegerField()
+ quux = peewee.IntegerField()
+```
+
+Add this model to the watch list and create migration.
+
+```bash
+$ pem add models.Foo
+Model 'models.Foo' was added to the watch list.
+$ pem watch
+Migration `0001_migration_201807191008` has been created.
+```
+
+Now you can list available migrations:
+
+```bash
+$ pem list
+[ ] 0001_migration_201807191008
+```
+
+Or view SQL that will be executed during migration:
+
+```bash
+$ pem show
+[ ] 0001_migration_201807191008:
+ SQL> CREATE TABLE "foo" ("id" SERIAL NOT NULL PRIMARY KEY, "bar" VARCHAR(50) NOT NULL, "baz" INTEGER NOT NULL, "quux" INTEGER NOT NULL) []
+ PY> set_done('0001_migration_201807191008')
+```
+
+Use `migrate` to run migrations:
+
+```bash
+$ pem migrate
+[X] 0001_migration_201807191008
+```
+
+Change model `Foo`
+
+```python
+class Foo(db.Model):
+ bar = peewee.CharField(max_length=20)
+ baz = peewee.IntegerField()
+ quux = peewee.IntegerField()
+ xyzzy = peewee.IntegerField()
+```
+
+and run `watch` to create new migration:
+
+```bash
+$ pem watch
+Migration `0002_migration_201807191036` has been created.
+$ pem show
+[ ] 0002_migration_201807191036:
+ SQL> ALTER TABLE "foo" ADD COLUMN "xyzzy" INTEGER []
+ SQL> ALTER TABLE "foo" RENAME COLUMN "bar" TO "old__bar" []
+ SQL> ALTER TABLE "foo" ADD COLUMN "bar" VARCHAR(20) []
+ SQL> UPDATE "foo" SET "xyzzy" = %s WHERE ("xyzzy" IS %s) [0, None]
+ SQL> UPDATE "foo" SET "bar" = SUBSTRING("old__bar", %s, %s) WHERE ("old__bar" IS NOT %s) [1, 20, None]
+ SQL> ALTER TABLE "foo" DROP COLUMN "old__bar" []
+ SQL> ALTER TABLE "foo" ALTER COLUMN "xyzzy" SET NOT NULL []
+ SQL> ALTER TABLE "foo" ALTER COLUMN "bar" SET NOT NULL []
+ PY> set_done('0002_migration_201807191036')
+```
+
+It's possible to create "serialized" migrations, run `pem watch --serialize`. In this case, explicit migration functions will be additionally created.
+
+```bash
+$ pem watch --serialize
+Migration `0001_migration_202112161523` has been created.
+```
+
+Additional code will be generated
+
+```python
+...
+
+def migrate_forward(op, old_orm, new_orm):
+ op.create_table(new_orm.foo)
+
+
+def migrate_backward(op, old_orm, new_orm):
+ op.drop_table(old_orm.foo)
+```
+
+And after changing the model
+
+```bash
+$ pem watch --serialize
+Migration `0002_migration_202112161527` has been created.
+```
+
+```python
+...
+
+def migrate_forward(op, old_orm, new_orm):
+ op.add_column(new_orm.foo.xyzzy)
+ op.rename_column(old_orm.foo.bar, 'old__bar')
+ op.add_column(new_orm.foo.bar)
+ op.run_data_migration()
+ op.drop_column(old_orm.foo.bar)
+ op.add_not_null(new_orm.foo.xyzzy)
+ op.add_not_null(new_orm.foo.bar)
+
+
+...
+
+def migrate_backward(op, old_orm, new_orm):
+ op.rename_column(old_orm.foo.bar, 'old__bar')
+ op.add_column(new_orm.foo.bar)
+ op.run_data_migration()
+ op.drop_column(old_orm.foo.xyzzy)
+ op.drop_column(old_orm.foo.bar)
+ op.add_not_null(new_orm.foo.bar)
+
+```
+
+Serialized migrations are performed only according to the operations specified in the migrate functions.
+
+To run migrations without a transaction, use `pem migrate --autocommit`. To view a list of operations that will be performed in this mode, use `pem show --autocommit` (some operations may differ).
+
+For more information on using the commands see --help.
+
+## migrations.json
+```
+{
+ "prerun": "some code here", // some code to run before executing any command
+ "directory": "migrations", // folder to hold migrations
+ "history": "migratehistory", // table to hold migration history
+ "models": [ // list of models to watch
+ "module1.Model1",
+ "module2.Model2"
+ ]
+}
+```
+
+
+
+
+%prep
+%autosetup -n peewee-migrations-0.3.32
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-peewee-migrations -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 0.3.32-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..333f76a
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+fb07c04dd0445dc1b14196ee23aaae56 peewee-migrations-0.3.32.tar.gz