modify scripts

This commit is contained in:
2025-07-29 20:56:46 +08:00
parent 7b81d59d1e
commit 1ba1a57f03
31 changed files with 3312 additions and 244 deletions

View File

@ -0,0 +1,147 @@
# A generic, single database configuration.
[alembic]
# path to migration scripts.
# this is typically a path given in POSIX (e.g. forward slashes)
# format, relative to the token %(here)s which refers to the location of this
# ini file
script_location = %(here)s
# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
# Uncomment the line below if you want the files to be prepended with date and time
# see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
# for all available tokens
# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
# sys.path path, will be prepended to sys.path if present.
# defaults to the current working directory. for multiple paths, the path separator
# is defined by "path_separator" below.
prepend_sys_path = .
# timezone to use when rendering the date within the migration file
# as well as the filename.
# If specified, requires the python>=3.9 or backports.zoneinfo library and tzdata library.
# Any required deps can installed by adding `alembic[tz]` to the pip requirements
# string value is passed to ZoneInfo()
# leave blank for localtime
# timezone =
# max length of characters to apply to the "slug" field
# truncate_slug_length = 40
# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false
# set to 'true' to allow .pyc and .pyo files without
# a source .py file to be detected as revisions in the
# versions/ directory
# sourceless = false
# version location specification; This defaults
# to <script_location>/versions. When using multiple version
# directories, initial revisions must be specified with --version-path.
# The path separator used here should be the separator specified by "path_separator"
# below.
# version_locations = %(here)s/bar:%(here)s/bat:%(here)s/alembic/versions
# path_separator; This indicates what character is used to split lists of file
# paths, including version_locations and prepend_sys_path within configparser
# files such as alembic.ini.
# The default rendered in new alembic.ini files is "os", which uses os.pathsep
# to provide os-dependent path splitting.
#
# Note that in order to support legacy alembic.ini files, this default does NOT
# take place if path_separator is not present in alembic.ini. If this
# option is omitted entirely, fallback logic is as follows:
#
# 1. Parsing of the version_locations option falls back to using the legacy
# "version_path_separator" key, which if absent then falls back to the legacy
# behavior of splitting on spaces and/or commas.
# 2. Parsing of the prepend_sys_path option falls back to the legacy
# behavior of splitting on spaces, commas, or colons.
#
# Valid values for path_separator are:
#
# path_separator = :
# path_separator = ;
# path_separator = space
# path_separator = newline
#
# Use os.pathsep. Default configuration used for new projects.
path_separator = os
# set to 'true' to search source files recursively
# in each "version_locations" directory
# new in Alembic version 1.10
# recursive_version_locations = false
# the output encoding used when revision files
# are written from script.py.mako
# output_encoding = utf-8
# database URL. This is consumed by the user-maintained env.py script only.
# other means of configuring database URLs may be customized within the env.py
# file.
sqlalchemy.url = driver://user:pass@localhost/dbname
[post_write_hooks]
# post_write_hooks defines scripts or Python functions that are run
# on newly generated revision scripts. See the documentation for further
# detail and examples
# format using "black" - use the console_scripts runner, against the "black" entrypoint
# hooks = black
# black.type = console_scripts
# black.entrypoint = black
# black.options = -l 79 REVISION_SCRIPT_FILENAME
# lint with attempts to fix using "ruff" - use the module runner, against the "ruff" module
# hooks = ruff
# ruff.type = module
# ruff.module = ruff
# ruff.options = check --fix REVISION_SCRIPT_FILENAME
# Alternatively, use the exec runner to execute a binary found on your PATH
# hooks = ruff
# ruff.type = exec
# ruff.executable = ruff
# ruff.options = check --fix REVISION_SCRIPT_FILENAME
# Logging configuration. This is also consumed by the user-maintained
# env.py script only.
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARNING
handlers = console
qualname =
[logger_sqlalchemy]
level = WARNING
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S

View File

@ -0,0 +1 @@
Generic single-database configuration.

View File

@ -0,0 +1,147 @@
# A generic, single database configuration.
[alembic]
# path to migration scripts.
# this is typically a path given in POSIX (e.g. forward slashes)
# format, relative to the token %(here)s which refers to the location of this
# ini file
script_location = %(here)s
# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
# Uncomment the line below if you want the files to be prepended with date and time
# see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
# for all available tokens
# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
# sys.path path, will be prepended to sys.path if present.
# defaults to the current working directory. for multiple paths, the path separator
# is defined by "path_separator" below.
prepend_sys_path = .
# timezone to use when rendering the date within the migration file
# as well as the filename.
# If specified, requires the python>=3.9 or backports.zoneinfo library and tzdata library.
# Any required deps can installed by adding `alembic[tz]` to the pip requirements
# string value is passed to ZoneInfo()
# leave blank for localtime
# timezone =
# max length of characters to apply to the "slug" field
# truncate_slug_length = 40
# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false
# set to 'true' to allow .pyc and .pyo files without
# a source .py file to be detected as revisions in the
# versions/ directory
# sourceless = false
# version location specification; This defaults
# to <script_location>/versions. When using multiple version
# directories, initial revisions must be specified with --version-path.
# The path separator used here should be the separator specified by "path_separator"
# below.
# version_locations = %(here)s/bar:%(here)s/bat:%(here)s/alembic/versions
# path_separator; This indicates what character is used to split lists of file
# paths, including version_locations and prepend_sys_path within configparser
# files such as alembic.ini.
# The default rendered in new alembic.ini files is "os", which uses os.pathsep
# to provide os-dependent path splitting.
#
# Note that in order to support legacy alembic.ini files, this default does NOT
# take place if path_separator is not present in alembic.ini. If this
# option is omitted entirely, fallback logic is as follows:
#
# 1. Parsing of the version_locations option falls back to using the legacy
# "version_path_separator" key, which if absent then falls back to the legacy
# behavior of splitting on spaces and/or commas.
# 2. Parsing of the prepend_sys_path option falls back to the legacy
# behavior of splitting on spaces, commas, or colons.
#
# Valid values for path_separator are:
#
# path_separator = :
# path_separator = ;
# path_separator = space
# path_separator = newline
#
# Use os.pathsep. Default configuration used for new projects.
path_separator = os
# set to 'true' to search source files recursively
# in each "version_locations" directory
# new in Alembic version 1.10
# recursive_version_locations = false
# the output encoding used when revision files
# are written from script.py.mako
# output_encoding = utf-8
# database URL. This is consumed by the user-maintained env.py script only.
# other means of configuring database URLs may be customized within the env.py
# file.
sqlalchemy.url = driver://user:pass@localhost/dbname
[post_write_hooks]
# post_write_hooks defines scripts or Python functions that are run
# on newly generated revision scripts. See the documentation for further
# detail and examples
# format using "black" - use the console_scripts runner, against the "black" entrypoint
# hooks = black
# black.type = console_scripts
# black.entrypoint = black
# black.options = -l 79 REVISION_SCRIPT_FILENAME
# lint with attempts to fix using "ruff" - use the module runner, against the "ruff" module
# hooks = ruff
# ruff.type = module
# ruff.module = ruff
# ruff.options = check --fix REVISION_SCRIPT_FILENAME
# Alternatively, use the exec runner to execute a binary found on your PATH
# hooks = ruff
# ruff.type = exec
# ruff.executable = ruff
# ruff.options = check --fix REVISION_SCRIPT_FILENAME
# Logging configuration. This is also consumed by the user-maintained
# env.py script only.
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARNING
handlers = console
qualname =
[logger_sqlalchemy]
level = WARNING
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S

View File

@ -0,0 +1,100 @@
from logging.config import fileConfig
from sqlalchemy import engine_from_config
from sqlalchemy import pool
from alembic import context
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python logging.
# This line sets up loggers basically.
if config.config_file_name is not None:
fileConfig(config.config_file_name)
# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
target_metadata = None
# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")
# ... etc.
def run_migrations_offline() -> None:
"""Run migrations in 'offline' mode.
This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.
Calls to context.execute() here emit the given string to the
script output.
"""
url = config.get_main_option("sqlalchemy.url")
context.configure(
url=url,
target_metadata=target_metadata,
literal_binds=True,
dialect_opts={"paramstyle": "named"},
)
with context.begin_transaction():
context.run_migrations()
''' 修改点
from models.modelclass_b import Base
target_metadata = Base.metadata
def run_migrations_online():
url = "sqlite:///../databases/db_b.db"
connectable = create_engine(url)
# 保持其他代码不变
'''
import os
from alembic import context
from sqlalchemy import create_engine
from logging.config import fileConfig
from models.scrapy import Base
target_metadata = Base.metadata
home_dir = os.path.expanduser("~")
global_share_data_dir = f'{home_dir}/sharedata/sqlite'
def run_migrations_online() -> None:
"""Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context.
connectable = engine_from_config(
config.get_section(config.config_ini_section, {}),
prefix="sqlalchemy.",
poolclass=pool.NullPool,
)
"""
url = f"sqlite:///{global_share_data_dir}/scrapy.db"
connectable = create_engine(url)
with connectable.connect() as connection:
context.configure(
connection=connection, target_metadata=target_metadata
)
with context.begin_transaction():
context.run_migrations()
if context.is_offline_mode():
run_migrations_offline()
else:
run_migrations_online()

View File

@ -0,0 +1,28 @@
"""${message}
Revision ID: ${up_revision}
Revises: ${down_revision | comma,n}
Create Date: ${create_date}
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
${imports if imports else ""}
# revision identifiers, used by Alembic.
revision: str = ${repr(up_revision)}
down_revision: Union[str, Sequence[str], None] = ${repr(down_revision)}
branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
def upgrade() -> None:
"""Upgrade schema."""
${upgrades if upgrades else "pass"}
def downgrade() -> None:
"""Downgrade schema."""
${downgrades if downgrades else "pass"}

View File

@ -0,0 +1 @@
Generic single-database configuration.

View File

@ -0,0 +1,147 @@
# A generic, single database configuration.
[alembic]
# path to migration scripts.
# this is typically a path given in POSIX (e.g. forward slashes)
# format, relative to the token %(here)s which refers to the location of this
# ini file
script_location = %(here)s
# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
# Uncomment the line below if you want the files to be prepended with date and time
# see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
# for all available tokens
# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
# sys.path path, will be prepended to sys.path if present.
# defaults to the current working directory. for multiple paths, the path separator
# is defined by "path_separator" below.
prepend_sys_path = .
# timezone to use when rendering the date within the migration file
# as well as the filename.
# If specified, requires the python>=3.9 or backports.zoneinfo library and tzdata library.
# Any required deps can installed by adding `alembic[tz]` to the pip requirements
# string value is passed to ZoneInfo()
# leave blank for localtime
# timezone =
# max length of characters to apply to the "slug" field
# truncate_slug_length = 40
# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false
# set to 'true' to allow .pyc and .pyo files without
# a source .py file to be detected as revisions in the
# versions/ directory
# sourceless = false
# version location specification; This defaults
# to <script_location>/versions. When using multiple version
# directories, initial revisions must be specified with --version-path.
# The path separator used here should be the separator specified by "path_separator"
# below.
# version_locations = %(here)s/bar:%(here)s/bat:%(here)s/alembic/versions
# path_separator; This indicates what character is used to split lists of file
# paths, including version_locations and prepend_sys_path within configparser
# files such as alembic.ini.
# The default rendered in new alembic.ini files is "os", which uses os.pathsep
# to provide os-dependent path splitting.
#
# Note that in order to support legacy alembic.ini files, this default does NOT
# take place if path_separator is not present in alembic.ini. If this
# option is omitted entirely, fallback logic is as follows:
#
# 1. Parsing of the version_locations option falls back to using the legacy
# "version_path_separator" key, which if absent then falls back to the legacy
# behavior of splitting on spaces and/or commas.
# 2. Parsing of the prepend_sys_path option falls back to the legacy
# behavior of splitting on spaces, commas, or colons.
#
# Valid values for path_separator are:
#
# path_separator = :
# path_separator = ;
# path_separator = space
# path_separator = newline
#
# Use os.pathsep. Default configuration used for new projects.
path_separator = os
# set to 'true' to search source files recursively
# in each "version_locations" directory
# new in Alembic version 1.10
# recursive_version_locations = false
# the output encoding used when revision files
# are written from script.py.mako
# output_encoding = utf-8
# database URL. This is consumed by the user-maintained env.py script only.
# other means of configuring database URLs may be customized within the env.py
# file.
sqlalchemy.url = driver://user:pass@localhost/dbname
[post_write_hooks]
# post_write_hooks defines scripts or Python functions that are run
# on newly generated revision scripts. See the documentation for further
# detail and examples
# format using "black" - use the console_scripts runner, against the "black" entrypoint
# hooks = black
# black.type = console_scripts
# black.entrypoint = black
# black.options = -l 79 REVISION_SCRIPT_FILENAME
# lint with attempts to fix using "ruff" - use the module runner, against the "ruff" module
# hooks = ruff
# ruff.type = module
# ruff.module = ruff
# ruff.options = check --fix REVISION_SCRIPT_FILENAME
# Alternatively, use the exec runner to execute a binary found on your PATH
# hooks = ruff
# ruff.type = exec
# ruff.executable = ruff
# ruff.options = check --fix REVISION_SCRIPT_FILENAME
# Logging configuration. This is also consumed by the user-maintained
# env.py script only.
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARNING
handlers = console
qualname =
[logger_sqlalchemy]
level = WARNING
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S

View File

@ -0,0 +1,101 @@
from logging.config import fileConfig
from sqlalchemy import engine_from_config
from sqlalchemy import pool
from alembic import context
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python logging.
# This line sets up loggers basically.
if config.config_file_name is not None:
fileConfig(config.config_file_name)
# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
target_metadata = None
# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")
# ... etc.
def run_migrations_offline() -> None:
"""Run migrations in 'offline' mode.
This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.
Calls to context.execute() here emit the given string to the
script output.
"""
url = config.get_main_option("sqlalchemy.url")
context.configure(
url=url,
target_metadata=target_metadata,
literal_binds=True,
dialect_opts={"paramstyle": "named"},
)
with context.begin_transaction():
context.run_migrations()
''' 修改点
from models.modelclass_b import Base
target_metadata = Base.metadata
def run_migrations_online():
url = "sqlite:///../databases/db_b.db"
connectable = create_engine(url)
# 保持其他代码不变
'''
import os
from alembic import context
from sqlalchemy import create_engine
from logging.config import fileConfig
from models.shared import Base
target_metadata = Base.metadata
home_dir = os.path.expanduser("~")
global_share_data_dir = f'{home_dir}/sharedata/sqlite'
def run_migrations_online() -> None:
"""Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context.
connectable = engine_from_config(
config.get_section(config.config_ini_section, {}),
prefix="sqlalchemy.",
poolclass=pool.NullPool,
)
"""
url = f"sqlite:///{global_share_data_dir}/shared.db"
connectable = create_engine(url)
with connectable.connect() as connection:
context.configure(
connection=connection, target_metadata=target_metadata
)
with context.begin_transaction():
context.run_migrations()
if context.is_offline_mode():
run_migrations_offline()
else:
run_migrations_online()

View File

@ -0,0 +1,28 @@
"""${message}
Revision ID: ${up_revision}
Revises: ${down_revision | comma,n}
Create Date: ${create_date}
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
${imports if imports else ""}
# revision identifiers, used by Alembic.
revision: str = ${repr(up_revision)}
down_revision: Union[str, Sequence[str], None] = ${repr(down_revision)}
branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
def upgrade() -> None:
"""Upgrade schema."""
${upgrades if upgrades else "pass"}
def downgrade() -> None:
"""Downgrade schema."""
${downgrades if downgrades else "pass"}

View File

@ -0,0 +1,34 @@
"""Auto update from shared_comm
Revision ID: 098c67f16b5e
Revises:
Create Date: 2025-07-29 20:01:58.175086
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '098c67f16b5e'
down_revision: Union[str, Sequence[str], None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
"""Upgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('javdb_actors', sa.Column('movies_cnt', sa.Integer(), server_default=sa.text('0'), nullable=False))
op.add_column('javdb_actors', sa.Column('uncensored', sa.Integer(), server_default=sa.text('0'), nullable=False))
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('javdb_actors', 'uncensored')
op.drop_column('javdb_actors', 'movies_cnt')
# ### end Alembic commands ###

View File

@ -0,0 +1 @@
Generic single-database configuration.

View File

@ -0,0 +1,147 @@
# A generic, single database configuration.
[alembic]
# path to migration scripts.
# this is typically a path given in POSIX (e.g. forward slashes)
# format, relative to the token %(here)s which refers to the location of this
# ini file
script_location = %(here)s
# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
# Uncomment the line below if you want the files to be prepended with date and time
# see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
# for all available tokens
# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
# sys.path path, will be prepended to sys.path if present.
# defaults to the current working directory. for multiple paths, the path separator
# is defined by "path_separator" below.
prepend_sys_path = .
# timezone to use when rendering the date within the migration file
# as well as the filename.
# If specified, requires the python>=3.9 or backports.zoneinfo library and tzdata library.
# Any required deps can installed by adding `alembic[tz]` to the pip requirements
# string value is passed to ZoneInfo()
# leave blank for localtime
# timezone =
# max length of characters to apply to the "slug" field
# truncate_slug_length = 40
# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false
# set to 'true' to allow .pyc and .pyo files without
# a source .py file to be detected as revisions in the
# versions/ directory
# sourceless = false
# version location specification; This defaults
# to <script_location>/versions. When using multiple version
# directories, initial revisions must be specified with --version-path.
# The path separator used here should be the separator specified by "path_separator"
# below.
# version_locations = %(here)s/bar:%(here)s/bat:%(here)s/alembic/versions
# path_separator; This indicates what character is used to split lists of file
# paths, including version_locations and prepend_sys_path within configparser
# files such as alembic.ini.
# The default rendered in new alembic.ini files is "os", which uses os.pathsep
# to provide os-dependent path splitting.
#
# Note that in order to support legacy alembic.ini files, this default does NOT
# take place if path_separator is not present in alembic.ini. If this
# option is omitted entirely, fallback logic is as follows:
#
# 1. Parsing of the version_locations option falls back to using the legacy
# "version_path_separator" key, which if absent then falls back to the legacy
# behavior of splitting on spaces and/or commas.
# 2. Parsing of the prepend_sys_path option falls back to the legacy
# behavior of splitting on spaces, commas, or colons.
#
# Valid values for path_separator are:
#
# path_separator = :
# path_separator = ;
# path_separator = space
# path_separator = newline
#
# Use os.pathsep. Default configuration used for new projects.
path_separator = os
# set to 'true' to search source files recursively
# in each "version_locations" directory
# new in Alembic version 1.10
# recursive_version_locations = false
# the output encoding used when revision files
# are written from script.py.mako
# output_encoding = utf-8
# database URL. This is consumed by the user-maintained env.py script only.
# other means of configuring database URLs may be customized within the env.py
# file.
sqlalchemy.url = driver://user:pass@localhost/dbname
[post_write_hooks]
# post_write_hooks defines scripts or Python functions that are run
# on newly generated revision scripts. See the documentation for further
# detail and examples
# format using "black" - use the console_scripts runner, against the "black" entrypoint
# hooks = black
# black.type = console_scripts
# black.entrypoint = black
# black.options = -l 79 REVISION_SCRIPT_FILENAME
# lint with attempts to fix using "ruff" - use the module runner, against the "ruff" module
# hooks = ruff
# ruff.type = module
# ruff.module = ruff
# ruff.options = check --fix REVISION_SCRIPT_FILENAME
# Alternatively, use the exec runner to execute a binary found on your PATH
# hooks = ruff
# ruff.type = exec
# ruff.executable = ruff
# ruff.options = check --fix REVISION_SCRIPT_FILENAME
# Logging configuration. This is also consumed by the user-maintained
# env.py script only.
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARNING
handlers = console
qualname =
[logger_sqlalchemy]
level = WARNING
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S

View File

@ -0,0 +1,108 @@
from logging.config import fileConfig
from sqlalchemy import engine_from_config
from sqlalchemy import pool
from alembic import context
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python logging.
# This line sets up loggers basically.
if config.config_file_name is not None:
fileConfig(config.config_file_name)
# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
target_metadata = None
# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")
# ... etc.
def run_migrations_offline() -> None:
"""Run migrations in 'offline' mode.
This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.
Calls to context.execute() here emit the given string to the
script output.
"""
url = config.get_main_option("sqlalchemy.url")
context.configure(
url=url,
target_metadata=target_metadata,
literal_binds=True,
dialect_opts={"paramstyle": "named"},
)
with context.begin_transaction():
context.run_migrations()
''' 修改点
from models.modelclass_b import Base
target_metadata = Base.metadata
def run_migrations_online():
url = "sqlite:///../databases/db_b.db"
connectable = create_engine(url)
# 保持其他代码不变
'''
import os
from alembic import context
from sqlalchemy import create_engine
from logging.config import fileConfig
from models.shared import Base as BaseShared
from models.scrapy import Base as BaseScrapy
# 合并元数据
from sqlalchemy import MetaData
target_metadata = MetaData()
for t in BaseShared.metadata.tables.values():
t.tometadata(target_metadata)
for t in BaseScrapy.metadata.tables.values():
t.tometadata(target_metadata)
home_dir = os.path.expanduser("~")
global_share_data_dir = f'{home_dir}/sharedata/sqlite'
def run_migrations_online() -> None:
"""Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context.
connectable = engine_from_config(
config.get_section(config.config_ini_section, {}),
prefix="sqlalchemy.",
poolclass=pool.NullPool,
)
"""
url = f"sqlite:///{global_share_data_dir}/test.db"
connectable = create_engine(url)
with connectable.connect() as connection:
context.configure(
connection=connection, target_metadata=target_metadata
)
with context.begin_transaction():
context.run_migrations()
if context.is_offline_mode():
run_migrations_offline()
else:
run_migrations_online()

View File

@ -0,0 +1,28 @@
"""${message}
Revision ID: ${up_revision}
Revises: ${down_revision | comma,n}
Create Date: ${create_date}
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
${imports if imports else ""}
# revision identifiers, used by Alembic.
revision: str = ${repr(up_revision)}
down_revision: Union[str, Sequence[str], None] = ${repr(down_revision)}
branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
def upgrade() -> None:
"""Upgrade schema."""
${upgrades if upgrades else "pass"}
def downgrade() -> None:
"""Downgrade schema."""
${downgrades if downgrades else "pass"}

View File

@ -0,0 +1,34 @@
"""Initial test schema
Revision ID: 854378c8e332
Revises: bce23e0d0c3a
Create Date: 2025-07-29 19:58:01.503647
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '854378c8e332'
down_revision: Union[str, Sequence[str], None] = 'bce23e0d0c3a'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
"""Upgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('javdb_actors', sa.Column('movies_cnt', sa.Integer(), server_default=sa.text('0'), nullable=False))
op.add_column('javdb_actors', sa.Column('uncensored', sa.Integer(), server_default=sa.text('0'), nullable=False))
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('javdb_actors', 'uncensored')
op.drop_column('javdb_actors', 'movies_cnt')
# ### end Alembic commands ###

View File

@ -0,0 +1,674 @@
"""Initial test schema
Revision ID: 86eea10972c0
Revises:
Create Date: 2025-07-29 19:25:41.776214
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '86eea10972c0'
down_revision: Union[str, Sequence[str], None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
"""Upgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('clm_index',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('category', sa.Text(), nullable=True),
sa.Column('title', sa.Text(), nullable=True),
sa.Column('href', sa.Text(), nullable=True),
sa.Column('magnet_href', sa.Text(), nullable=True),
sa.Column('size_text', sa.Text(), nullable=True),
sa.Column('size_gb', sa.REAL(), nullable=True),
sa.Column('heat', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.Column('add_date', sa.Text(), nullable=True),
sa.Column('last_down_date', sa.Text(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('href')
)
op.create_table('clm_keywords',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('words', sa.Text(), nullable=True),
sa.Column('groups', sa.Text(), nullable=True),
sa.Column('tags', sa.Text(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('index_count', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('words')
)
op.create_table('iafd_distributors',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('href', sa.String(length=255), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('details', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('iafd_meta_ethnic',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('href', sa.String(length=255), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('iafd_performers',
sa.Column('name', sa.Text(), nullable=False),
sa.Column('is_full_data', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('birth_year', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_astro_list', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_birth_list', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_ethnic_list', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_movie_list', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('gender', sa.Text(), nullable=True),
sa.Column('birthday', sa.Text(), nullable=True),
sa.Column('astrology', sa.Text(), nullable=True),
sa.Column('birthplace', sa.Text(), nullable=True),
sa.Column('years_active', sa.Text(), nullable=True),
sa.Column('ethnicity', sa.Text(), nullable=True),
sa.Column('nationality', sa.Text(), nullable=True),
sa.Column('hair_colors', sa.Text(), nullable=True),
sa.Column('eye_color', sa.Text(), nullable=True),
sa.Column('height_str', sa.Text(), nullable=True),
sa.Column('weight_str', sa.Text(), nullable=True),
sa.Column('measurements', sa.Text(), nullable=True),
sa.Column('tattoos', sa.Text(), nullable=True),
sa.Column('piercings', sa.Text(), nullable=True),
sa.Column('fake_tits', sa.Text(), nullable=True),
sa.Column('href', sa.Text(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('weight', sa.Integer(), nullable=True),
sa.Column('height', sa.Integer(), nullable=True),
sa.Column('rating', sa.Integer(), nullable=True),
sa.Column('movies_cnt', sa.Integer(), nullable=True),
sa.Column('vixen_cnt', sa.Integer(), nullable=True),
sa.Column('blacked_cnt', sa.Integer(), nullable=True),
sa.Column('tushy_cnt', sa.Integer(), nullable=True),
sa.Column('x_art_cnt', sa.Integer(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('href')
)
op.create_table('iafd_studios',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('href', sa.String(length=255), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('details', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('iafd_task_log',
sa.Column('task_id', sa.Integer(), nullable=False),
sa.Column('full_data_performers', sa.Integer(), nullable=True),
sa.Column('total_performers', sa.Integer(), nullable=True),
sa.Column('full_data_movies', sa.Integer(), nullable=True),
sa.Column('total_movies', sa.Integer(), nullable=True),
sa.Column('total_distributors', sa.Integer(), nullable=True),
sa.Column('total_studios', sa.Integer(), nullable=True),
sa.Column('task_status', sa.String(length=255), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.PrimaryKeyConstraint('task_id')
)
op.create_table('javbus_actors',
sa.Column('uncensored', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('is_full_data', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_actor_list', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_movie_list', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('movies_cnt', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('ja_name', sa.Text(), nullable=True),
sa.Column('zh_name', sa.Text(), nullable=True),
sa.Column('en_name', sa.Text(), nullable=True),
sa.Column('href', sa.Text(), nullable=True),
sa.Column('pic', sa.Text(), nullable=True),
sa.Column('birth_date', sa.Text(), nullable=True),
sa.Column('height', sa.Text(), nullable=True),
sa.Column('breast_size', sa.Text(), nullable=True),
sa.Column('measurements', sa.Text(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('href')
)
op.create_table('javbus_labels',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('en_name', sa.String(length=255), nullable=True),
sa.Column('ja_name', sa.String(length=255), nullable=True),
sa.Column('href', sa.String(length=255), nullable=True),
sa.Column('details', sa.Text(), nullable=True),
sa.Column('uncensored', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.Column('from_list', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.Column('from_movie_list', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('movies_cnt', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.Column('magnet_cnt', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('javbus_movies',
sa.Column('is_full_data', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('uncensored', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_actor_list', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_movie_studios', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_movie_labels', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_movie_series', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('actors_cnt', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('href', sa.Text(), nullable=True),
sa.Column('title', sa.Text(), nullable=True),
sa.Column('cover_url', sa.Text(), nullable=True),
sa.Column('serial_number', sa.Text(), nullable=True),
sa.Column('release_date', sa.Text(), nullable=True),
sa.Column('duration', sa.Text(), nullable=True),
sa.Column('studio_id', sa.Integer(), nullable=True),
sa.Column('label_id', sa.Integer(), nullable=True),
sa.Column('series_id', sa.Integer(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('href')
)
op.create_table('javbus_series',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('en_name', sa.String(length=255), nullable=True),
sa.Column('ja_name', sa.String(length=255), nullable=True),
sa.Column('href', sa.String(length=255), nullable=True),
sa.Column('details', sa.Text(), nullable=True),
sa.Column('uncensored', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.Column('from_list', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.Column('from_movie_list', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('movies_cnt', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.Column('magnet_cnt', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('javbus_studios',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('en_name', sa.String(length=255), nullable=True),
sa.Column('ja_name', sa.String(length=255), nullable=True),
sa.Column('href', sa.String(length=255), nullable=True),
sa.Column('details', sa.Text(), nullable=True),
sa.Column('uncensored', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.Column('from_list', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.Column('from_movie_list', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('movies_cnt', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.Column('magnet_cnt', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('javbus_tags',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('en_name', sa.String(length=255), nullable=True),
sa.Column('ja_name', sa.String(length=255), nullable=True),
sa.Column('href', sa.String(length=255), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('javdb_actors',
sa.Column('name', sa.Text(), nullable=False),
sa.Column('href', sa.Text(), nullable=False),
sa.Column('is_full_data', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_actor_list', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_movie_list', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('pic', sa.Text(), nullable=True),
sa.Column('created_at', sa.DateTime(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.DateTime(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('href')
)
op.create_table('javdb_makers',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('href', sa.String(length=255), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('details', sa.Text(), nullable=True),
sa.Column('from_list', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.Column('from_movie_list', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('javdb_movies',
sa.Column('is_full_data', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_actor_list', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_movie_makers', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_movie_series', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_movie_publishers', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('uncensored', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('href', sa.Text(), nullable=True),
sa.Column('title', sa.Text(), nullable=True),
sa.Column('cover_url', sa.Text(), nullable=True),
sa.Column('serial_number', sa.Text(), nullable=True),
sa.Column('release_date', sa.Text(), nullable=True),
sa.Column('duration', sa.Text(), nullable=True),
sa.Column('maker_id', sa.Text(), nullable=True),
sa.Column('series_id', sa.Text(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('pub_id', sa.Integer(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('href')
)
op.create_table('javdb_publishers',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('href', sa.String(length=255), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('details', sa.Text(), nullable=True),
sa.Column('from_list', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.Column('from_movie_list', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('javdb_series',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('href', sa.String(length=255), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('details', sa.Text(), nullable=True),
sa.Column('from_list', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.Column('from_movie_list', sa.Integer(), server_default=sa.text('0'), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('javdb_tags',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('href', sa.String(length=255), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('javdb_task_log',
sa.Column('task_id', sa.Integer(), nullable=False),
sa.Column('full_data_actors', sa.Integer(), nullable=True),
sa.Column('total_actors', sa.Integer(), nullable=True),
sa.Column('full_data_movies', sa.Integer(), nullable=True),
sa.Column('total_movies', sa.Integer(), nullable=True),
sa.Column('total_makers', sa.Integer(), nullable=True),
sa.Column('total_series', sa.Integer(), nullable=True),
sa.Column('task_status', sa.String(length=255), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.PrimaryKeyConstraint('task_id')
)
op.create_table('javhd_models',
sa.Column('is_full_data', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('rank', sa.Integer(), nullable=True),
sa.Column('ja_name', sa.Text(), nullable=True),
sa.Column('zh_name', sa.Text(), nullable=True),
sa.Column('en_name', sa.Text(), nullable=True),
sa.Column('url', sa.Text(), nullable=True),
sa.Column('pic', sa.Text(), nullable=True),
sa.Column('height', sa.Text(), nullable=True),
sa.Column('weight', sa.Text(), nullable=True),
sa.Column('breast_size', sa.Text(), nullable=True),
sa.Column('breast_factor', sa.Text(), nullable=True),
sa.Column('hair_color', sa.Text(), nullable=True),
sa.Column('eye_color', sa.Text(), nullable=True),
sa.Column('birth_date', sa.Text(), nullable=True),
sa.Column('ethnicity', sa.Text(), nullable=True),
sa.Column('birth_place', sa.Text(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('url')
)
op.create_table('pbox_actors',
sa.Column('name', sa.Text(), nullable=False),
sa.Column('movies_cnt', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('is_full_data', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('href', sa.Text(), nullable=True),
sa.Column('gender', sa.Text(), nullable=True),
sa.Column('age', sa.Integer(), nullable=True),
sa.Column('nationality', sa.Text(), nullable=True),
sa.Column('country', sa.Text(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('href')
)
op.create_table('pbox_studios',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('label_id', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('scene_count', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('href', sa.String(length=255), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('description', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('pbox_tags',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('href', sa.String(length=255), nullable=True),
sa.Column('tag_id', sa.Integer(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('sis',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('plate_name', sa.Text(), nullable=True),
sa.Column('title', sa.Text(), nullable=True),
sa.Column('url', sa.Text(), nullable=True),
sa.Column('size_text', sa.Text(), nullable=True),
sa.Column('size_gb', sa.REAL(), nullable=True),
sa.Column('update_date', sa.Text(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('url')
)
op.create_table('thelordofporn_actress',
sa.Column('is_full_data', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('pornstar', sa.Text(), nullable=True),
sa.Column('rating', sa.REAL(), nullable=True),
sa.Column('rank', sa.Integer(), nullable=True),
sa.Column('votes', sa.Integer(), nullable=True),
sa.Column('href', sa.Text(), nullable=True),
sa.Column('career_start', sa.Text(), nullable=True),
sa.Column('measurements', sa.Text(), nullable=True),
sa.Column('born', sa.Text(), nullable=True),
sa.Column('height', sa.Text(), nullable=True),
sa.Column('weight', sa.Text(), nullable=True),
sa.Column('date_modified', sa.Text(), nullable=True),
sa.Column('global_rank', sa.Integer(), nullable=True),
sa.Column('weekly_rank', sa.Integer(), nullable=True),
sa.Column('last_month_rating', sa.REAL(), nullable=True),
sa.Column('current_rating', sa.REAL(), nullable=True),
sa.Column('total_votes', sa.Integer(), nullable=True),
sa.Column('birth_date', sa.Text(), nullable=True),
sa.Column('birth_year', sa.Text(), nullable=True),
sa.Column('birth_place', sa.Text(), nullable=True),
sa.Column('height_ft', sa.Text(), nullable=True),
sa.Column('height_cm', sa.Text(), nullable=True),
sa.Column('weight_lbs', sa.Text(), nullable=True),
sa.Column('weight_kg', sa.Text(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('href')
)
op.create_table('u3c3',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('category', sa.Text(), nullable=True),
sa.Column('title', sa.Text(), nullable=True),
sa.Column('url', sa.Text(), nullable=True),
sa.Column('torrent_url', sa.Text(), nullable=True),
sa.Column('magnet_url', sa.Text(), nullable=True),
sa.Column('size_text', sa.Text(), nullable=True),
sa.Column('size_gb', sa.REAL(), nullable=True),
sa.Column('update_date', sa.Text(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('url')
)
op.create_table('clm_keywords_index',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('words_id', sa.Integer(), nullable=True),
sa.Column('index_id', sa.Integer(), nullable=True),
sa.Column('wid_iid', sa.String(length=255), nullable=True),
sa.Column('tags', sa.Text(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.ForeignKeyConstraint(['index_id'], ['clm_index.id'], ),
sa.ForeignKeyConstraint(['words_id'], ['clm_keywords.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('iafd_movies',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('is_full_data', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('release_year', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_performer_list', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_dist_list', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('from_stu_list', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('title', sa.String(length=255), nullable=True),
sa.Column('minutes', sa.String(length=255), nullable=True),
sa.Column('distributor_id', sa.Integer(), nullable=True),
sa.Column('studio_id', sa.Integer(), nullable=True),
sa.Column('release_date', sa.String(length=255), nullable=True),
sa.Column('added_to_IAFD_date', sa.String(length=255), nullable=True),
sa.Column('all_girl', sa.String(length=255), nullable=True),
sa.Column('all_male', sa.String(length=255), nullable=True),
sa.Column('compilation', sa.String(length=255), nullable=True),
sa.Column('webscene', sa.String(length=255), nullable=True),
sa.Column('director_id', sa.Integer(), nullable=True),
sa.Column('href', sa.String(length=255), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.ForeignKeyConstraint(['distributor_id'], ['iafd_distributors.id'], ),
sa.ForeignKeyConstraint(['studio_id'], ['iafd_studios.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('iafd_performer_aliases',
sa.Column('performer_id', sa.Integer(), nullable=False),
sa.Column('alias', sa.String(length=255), nullable=False),
sa.ForeignKeyConstraint(['performer_id'], ['iafd_performers.id'], ),
sa.PrimaryKeyConstraint('performer_id', 'alias')
)
op.create_table('iafd_performer_urls',
sa.Column('performer_id', sa.Integer(), nullable=False),
sa.Column('position', sa.String(length=255), nullable=False),
sa.Column('url', sa.String(length=255), nullable=False),
sa.ForeignKeyConstraint(['performer_id'], ['iafd_performers.id'], ),
sa.PrimaryKeyConstraint('performer_id', 'position', 'url')
)
op.create_table('javbus_actors_movies',
sa.Column('actor_id', sa.Integer(), nullable=False),
sa.Column('movie_id', sa.Integer(), nullable=False),
sa.Column('tags', sa.Text(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.ForeignKeyConstraint(['actor_id'], ['javbus_actors.id'], ),
sa.ForeignKeyConstraint(['movie_id'], ['javbus_movies.id'], ),
sa.PrimaryKeyConstraint('actor_id', 'movie_id')
)
op.create_index('idx_actor_movie_actor_id', 'javbus_actors_movies', ['actor_id'], unique=False)
op.create_table('javbus_movies_tags',
sa.Column('movie_id', sa.Integer(), nullable=False),
sa.Column('tag_id', sa.Integer(), nullable=False),
sa.Column('tags', sa.Text(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.ForeignKeyConstraint(['movie_id'], ['javbus_movies.id'], ),
sa.ForeignKeyConstraint(['tag_id'], ['javbus_tags.id'], ),
sa.PrimaryKeyConstraint('movie_id', 'tag_id')
)
op.create_table('javdb_actors_alias',
sa.Column('actor_id', sa.Integer(), nullable=False),
sa.Column('alias', sa.Text(), nullable=False),
sa.Column('created_at', sa.DateTime(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.DateTime(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.ForeignKeyConstraint(['actor_id'], ['javdb_actors.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('actor_id', 'alias')
)
op.create_table('javdb_actors_movies',
sa.Column('actor_id', sa.Integer(), nullable=False),
sa.Column('movie_id', sa.Integer(), nullable=False),
sa.Column('tags', sa.Text(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['actor_id'], ['javdb_actors.id'], ),
sa.ForeignKeyConstraint(['movie_id'], ['javdb_movies.id'], ),
sa.PrimaryKeyConstraint('actor_id', 'movie_id')
)
op.create_table('javdb_movies_tags',
sa.Column('movie_id', sa.Integer(), nullable=False),
sa.Column('tag_id', sa.Integer(), nullable=False),
sa.Column('tags', sa.Text(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.ForeignKeyConstraint(['movie_id'], ['javdb_movies.id'], ),
sa.ForeignKeyConstraint(['tag_id'], ['javdb_tags.id'], ),
sa.PrimaryKeyConstraint('movie_id', 'tag_id')
)
op.create_table('pbox_actor_aliases',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('actor_id', sa.Integer(), nullable=False),
sa.Column('alias', sa.String(length=255), nullable=False),
sa.Column('actor_alias', sa.String(length=255), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.ForeignKeyConstraint(['actor_id'], ['pbox_actors.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('pbox_movies',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('is_full_data', sa.Integer(), server_default=sa.text('0'), nullable=False),
sa.Column('href', sa.String(length=255), nullable=True),
sa.Column('title', sa.String(length=255), nullable=True),
sa.Column('movie_id', sa.Integer(), nullable=True),
sa.Column('content_id', sa.Integer(), nullable=True),
sa.Column('duration', sa.String(length=255), nullable=True),
sa.Column('publish_date', sa.String(length=255), nullable=True),
sa.Column('release_date', sa.String(length=255), nullable=True),
sa.Column('studio_id', sa.Integer(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.ForeignKeyConstraint(['studio_id'], ['pbox_studios.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('thelordofporn_alias',
sa.Column('actress_id', sa.Integer(), nullable=False),
sa.Column('alias', sa.Text(), nullable=False),
sa.Column('updated_at', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['actress_id'], ['thelordofporn_actress.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('actress_id', 'alias')
)
op.create_table('iafd_movies_appers_in',
sa.Column('movie_id', sa.Integer(), nullable=False),
sa.Column('appears_in_id', sa.Integer(), nullable=False),
sa.Column('gradation', sa.Integer(), nullable=True),
sa.Column('notes', sa.String(length=255), nullable=True),
sa.ForeignKeyConstraint(['appears_in_id'], ['iafd_movies.id'], ),
sa.ForeignKeyConstraint(['movie_id'], ['iafd_movies.id'], ),
sa.PrimaryKeyConstraint('movie_id', 'appears_in_id')
)
op.create_table('iafd_performers_movies',
sa.Column('performer_id', sa.Integer(), nullable=False),
sa.Column('movie_id', sa.Integer(), nullable=False),
sa.Column('role', sa.String(length=255), nullable=True),
sa.Column('notes', sa.String(length=255), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.ForeignKeyConstraint(['movie_id'], ['iafd_movies.id'], ),
sa.ForeignKeyConstraint(['performer_id'], ['iafd_performers.id'], ),
sa.PrimaryKeyConstraint('performer_id', 'movie_id')
)
op.create_index('idx_iafd_performers_movies_performer_id', 'iafd_performers_movies', ['performer_id'], unique=False)
op.create_table('pbox_actors_movies',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('actor_id', sa.Integer(), nullable=True),
sa.Column('movie_id', sa.Integer(), nullable=True),
sa.Column('actor_mov', sa.String(length=255), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('tags', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['actor_id'], ['pbox_actors.id'], ),
sa.ForeignKeyConstraint(['movie_id'], ['pbox_movies.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('pbox_movies_alts',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('min_mov_id', sa.Integer(), nullable=True),
sa.Column('max_mov_id', sa.Integer(), nullable=True),
sa.Column('min_max', sa.String(length=255), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.ForeignKeyConstraint(['max_mov_id'], ['pbox_movies.id'], ),
sa.ForeignKeyConstraint(['min_mov_id'], ['pbox_movies.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('pbox_movies_tags',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('movie_id', sa.Integer(), nullable=True),
sa.Column('tag_id', sa.Integer(), nullable=True),
sa.Column('movid_tagid', sa.String(length=255), nullable=True),
sa.Column('tags', sa.Text(), nullable=True),
sa.Column('created_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.Column('updated_at', sa.Text(), server_default=sa.text("(datetime('now', 'localtime'))"), nullable=True),
sa.ForeignKeyConstraint(['movie_id'], ['pbox_movies.id'], ),
sa.ForeignKeyConstraint(['tag_id'], ['pbox_tags.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('pbox_movies_tags')
op.drop_table('pbox_movies_alts')
op.drop_table('pbox_actors_movies')
op.drop_index('idx_iafd_performers_movies_performer_id', table_name='iafd_performers_movies')
op.drop_table('iafd_performers_movies')
op.drop_table('iafd_movies_appers_in')
op.drop_table('thelordofporn_alias')
op.drop_table('pbox_movies')
op.drop_table('pbox_actor_aliases')
op.drop_table('javdb_movies_tags')
op.drop_table('javdb_actors_movies')
op.drop_table('javdb_actors_alias')
op.drop_table('javbus_movies_tags')
op.drop_index('idx_actor_movie_actor_id', table_name='javbus_actors_movies')
op.drop_table('javbus_actors_movies')
op.drop_table('iafd_performer_urls')
op.drop_table('iafd_performer_aliases')
op.drop_table('iafd_movies')
op.drop_table('clm_keywords_index')
op.drop_table('u3c3')
op.drop_table('thelordofporn_actress')
op.drop_table('sis')
op.drop_table('pbox_tags')
op.drop_table('pbox_studios')
op.drop_table('pbox_actors')
op.drop_table('javhd_models')
op.drop_table('javdb_task_log')
op.drop_table('javdb_tags')
op.drop_table('javdb_series')
op.drop_table('javdb_publishers')
op.drop_table('javdb_movies')
op.drop_table('javdb_makers')
op.drop_table('javdb_actors')
op.drop_table('javbus_tags')
op.drop_table('javbus_studios')
op.drop_table('javbus_series')
op.drop_table('javbus_movies')
op.drop_table('javbus_labels')
op.drop_table('javbus_actors')
op.drop_table('iafd_task_log')
op.drop_table('iafd_studios')
op.drop_table('iafd_performers')
op.drop_table('iafd_meta_ethnic')
op.drop_table('iafd_distributors')
op.drop_table('clm_keywords')
op.drop_table('clm_index')
# ### end Alembic commands ###

View File

@ -0,0 +1,32 @@
"""Initial test schema
Revision ID: bce23e0d0c3a
Revises: 86eea10972c0
Create Date: 2025-07-29 19:54:54.268814
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'bce23e0d0c3a'
down_revision: Union[str, Sequence[str], None] = '86eea10972c0'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
"""Upgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###

View File

@ -0,0 +1,85 @@
from sqlalchemy import ForeignKey, Integer, REAL, String, Text, text
from typing import List, Optional
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship
class Base(DeclarativeBase):
pass
class ClmIndex(Base):
__tablename__ = 'clm_index'
id: Mapped[Optional[int]] = mapped_column(Integer, primary_key=True)
category: Mapped[Optional[str]] = mapped_column(Text)
title: Mapped[Optional[str]] = mapped_column(Text)
href: Mapped[Optional[str]] = mapped_column(Text, unique=True)
magnet_href: Mapped[Optional[str]] = mapped_column(Text)
size_text: Mapped[Optional[str]] = mapped_column(Text)
size_gb: Mapped[Optional[float]] = mapped_column(REAL)
heat: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
add_date: Mapped[Optional[str]] = mapped_column(Text)
last_down_date: Mapped[Optional[str]] = mapped_column(Text)
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
clm_keywords_index: Mapped[List['ClmKeywordsIndex']] = relationship('ClmKeywordsIndex', back_populates='index')
class ClmKeywords(Base):
__tablename__ = 'clm_keywords'
id: Mapped[Optional[int]] = mapped_column(Integer, primary_key=True)
words: Mapped[Optional[str]] = mapped_column(Text, unique=True)
groups: Mapped[Optional[str]] = mapped_column(Text)
tags: Mapped[Optional[str]] = mapped_column(Text)
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
index_count: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
clm_keywords_index: Mapped[List['ClmKeywordsIndex']] = relationship('ClmKeywordsIndex', back_populates='words')
class Sis(Base):
__tablename__ = 'sis'
id: Mapped[Optional[int]] = mapped_column(Integer, primary_key=True)
plate_name: Mapped[Optional[str]] = mapped_column(Text)
title: Mapped[Optional[str]] = mapped_column(Text)
url: Mapped[Optional[str]] = mapped_column(Text, unique=True)
size_text: Mapped[Optional[str]] = mapped_column(Text)
size_gb: Mapped[Optional[float]] = mapped_column(REAL)
update_date: Mapped[Optional[str]] = mapped_column(Text)
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
class U3c3(Base):
__tablename__ = 'u3c3'
id: Mapped[Optional[int]] = mapped_column(Integer, primary_key=True)
category: Mapped[Optional[str]] = mapped_column(Text)
title: Mapped[Optional[str]] = mapped_column(Text)
url: Mapped[Optional[str]] = mapped_column(Text, unique=True)
torrent_url: Mapped[Optional[str]] = mapped_column(Text)
magnet_url: Mapped[Optional[str]] = mapped_column(Text)
size_text: Mapped[Optional[str]] = mapped_column(Text)
size_gb: Mapped[Optional[float]] = mapped_column(REAL)
update_date: Mapped[Optional[str]] = mapped_column(Text)
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
class ClmKeywordsIndex(Base):
__tablename__ = 'clm_keywords_index'
id: Mapped[Optional[int]] = mapped_column(Integer, primary_key=True)
words_id: Mapped[Optional[int]] = mapped_column(ForeignKey('clm_keywords.id'))
index_id: Mapped[Optional[int]] = mapped_column(ForeignKey('clm_index.id'))
wid_iid: Mapped[Optional[str]] = mapped_column(String(255))
tags: Mapped[Optional[str]] = mapped_column(Text)
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
index: Mapped[Optional['ClmIndex']] = relationship('ClmIndex', back_populates='clm_keywords_index')
words: Mapped[Optional['ClmKeywords']] = relationship('ClmKeywords', back_populates='clm_keywords_index')

View File

@ -0,0 +1,670 @@
from sqlalchemy import DateTime, ForeignKey, Index, Integer, REAL, String, Text, text
from typing import List, Optional
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship
import datetime
class Base(DeclarativeBase):
pass
class IafdDistributors(Base):
__tablename__ = 'iafd_distributors'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
name: Mapped[str] = mapped_column(String(255))
href: Mapped[Optional[str]] = mapped_column(String(255))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
details: Mapped[Optional[str]] = mapped_column(Text)
iafd_movies: Mapped[List['IafdMovies']] = relationship('IafdMovies', back_populates='distributor')
class IafdMetaEthnic(Base):
__tablename__ = 'iafd_meta_ethnic'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
name: Mapped[str] = mapped_column(String(255))
href: Mapped[Optional[str]] = mapped_column(String(255))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
class IafdPerformers(Base):
__tablename__ = 'iafd_performers'
name: Mapped[str] = mapped_column(Text)
is_full_data: Mapped[int] = mapped_column(Integer, server_default=text('0'))
birth_year: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_astro_list: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_birth_list: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_ethnic_list: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_movie_list: Mapped[int] = mapped_column(Integer, server_default=text('0'))
id: Mapped[Optional[int]] = mapped_column(Integer, primary_key=True)
gender: Mapped[Optional[str]] = mapped_column(Text)
birthday: Mapped[Optional[str]] = mapped_column(Text)
astrology: Mapped[Optional[str]] = mapped_column(Text)
birthplace: Mapped[Optional[str]] = mapped_column(Text)
years_active: Mapped[Optional[str]] = mapped_column(Text)
ethnicity: Mapped[Optional[str]] = mapped_column(Text)
nationality: Mapped[Optional[str]] = mapped_column(Text)
hair_colors: Mapped[Optional[str]] = mapped_column(Text)
eye_color: Mapped[Optional[str]] = mapped_column(Text)
height_str: Mapped[Optional[str]] = mapped_column(Text)
weight_str: Mapped[Optional[str]] = mapped_column(Text)
measurements: Mapped[Optional[str]] = mapped_column(Text)
tattoos: Mapped[Optional[str]] = mapped_column(Text)
piercings: Mapped[Optional[str]] = mapped_column(Text)
fake_tits: Mapped[Optional[str]] = mapped_column(Text)
href: Mapped[Optional[str]] = mapped_column(Text, unique=True)
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
weight: Mapped[Optional[int]] = mapped_column(Integer)
height: Mapped[Optional[int]] = mapped_column(Integer)
rating: Mapped[Optional[int]] = mapped_column(Integer)
movies_cnt: Mapped[Optional[int]] = mapped_column(Integer)
vixen_cnt: Mapped[Optional[int]] = mapped_column(Integer)
blacked_cnt: Mapped[Optional[int]] = mapped_column(Integer)
tushy_cnt: Mapped[Optional[int]] = mapped_column(Integer)
x_art_cnt: Mapped[Optional[int]] = mapped_column(Integer)
iafd_performer_aliases: Mapped[List['IafdPerformerAliases']] = relationship('IafdPerformerAliases', back_populates='performer')
iafd_performer_urls: Mapped[List['IafdPerformerUrls']] = relationship('IafdPerformerUrls', back_populates='performer')
iafd_performers_movies: Mapped[List['IafdPerformersMovies']] = relationship('IafdPerformersMovies', back_populates='performer')
class IafdStudios(Base):
__tablename__ = 'iafd_studios'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
name: Mapped[str] = mapped_column(String(255))
href: Mapped[Optional[str]] = mapped_column(String(255))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
details: Mapped[Optional[str]] = mapped_column(Text)
iafd_movies: Mapped[List['IafdMovies']] = relationship('IafdMovies', back_populates='studio')
class IafdTaskLog(Base):
__tablename__ = 'iafd_task_log'
task_id: Mapped[int] = mapped_column(Integer, primary_key=True)
full_data_performers: Mapped[Optional[int]] = mapped_column(Integer)
total_performers: Mapped[Optional[int]] = mapped_column(Integer)
full_data_movies: Mapped[Optional[int]] = mapped_column(Integer)
total_movies: Mapped[Optional[int]] = mapped_column(Integer)
total_distributors: Mapped[Optional[int]] = mapped_column(Integer)
total_studios: Mapped[Optional[int]] = mapped_column(Integer)
task_status: Mapped[Optional[str]] = mapped_column(String(255))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
class JavbusActors(Base):
__tablename__ = 'javbus_actors'
uncensored: Mapped[int] = mapped_column(Integer, server_default=text('0'))
is_full_data: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_actor_list: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_movie_list: Mapped[int] = mapped_column(Integer, server_default=text('0'))
movies_cnt: Mapped[int] = mapped_column(Integer, server_default=text('0'))
id: Mapped[Optional[int]] = mapped_column(Integer, primary_key=True)
ja_name: Mapped[Optional[str]] = mapped_column(Text)
zh_name: Mapped[Optional[str]] = mapped_column(Text)
en_name: Mapped[Optional[str]] = mapped_column(Text)
href: Mapped[Optional[str]] = mapped_column(Text, unique=True)
pic: Mapped[Optional[str]] = mapped_column(Text)
birth_date: Mapped[Optional[str]] = mapped_column(Text)
height: Mapped[Optional[str]] = mapped_column(Text)
breast_size: Mapped[Optional[str]] = mapped_column(Text)
measurements: Mapped[Optional[str]] = mapped_column(Text)
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
javbus_actors_movies: Mapped[List['JavbusActorsMovies']] = relationship('JavbusActorsMovies', back_populates='actor')
class JavbusLabels(Base):
__tablename__ = 'javbus_labels'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
name: Mapped[Optional[str]] = mapped_column(String(255))
en_name: Mapped[Optional[str]] = mapped_column(String(255))
ja_name: Mapped[Optional[str]] = mapped_column(String(255))
href: Mapped[Optional[str]] = mapped_column(String(255))
details: Mapped[Optional[str]] = mapped_column(Text)
uncensored: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
from_list: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
from_movie_list: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
movies_cnt: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
magnet_cnt: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
class JavbusMovies(Base):
__tablename__ = 'javbus_movies'
is_full_data: Mapped[int] = mapped_column(Integer, server_default=text('0'))
uncensored: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_actor_list: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_movie_studios: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_movie_labels: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_movie_series: Mapped[int] = mapped_column(Integer, server_default=text('0'))
actors_cnt: Mapped[int] = mapped_column(Integer, server_default=text('0'))
id: Mapped[Optional[int]] = mapped_column(Integer, primary_key=True)
href: Mapped[Optional[str]] = mapped_column(Text, unique=True)
title: Mapped[Optional[str]] = mapped_column(Text)
cover_url: Mapped[Optional[str]] = mapped_column(Text)
serial_number: Mapped[Optional[str]] = mapped_column(Text)
release_date: Mapped[Optional[str]] = mapped_column(Text)
duration: Mapped[Optional[str]] = mapped_column(Text)
studio_id: Mapped[Optional[int]] = mapped_column(Integer)
label_id: Mapped[Optional[int]] = mapped_column(Integer)
series_id: Mapped[Optional[int]] = mapped_column(Integer)
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
javbus_actors_movies: Mapped[List['JavbusActorsMovies']] = relationship('JavbusActorsMovies', back_populates='movie')
javbus_movies_tags: Mapped[List['JavbusMoviesTags']] = relationship('JavbusMoviesTags', back_populates='movie')
class JavbusSeries(Base):
__tablename__ = 'javbus_series'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
name: Mapped[Optional[str]] = mapped_column(String(255))
en_name: Mapped[Optional[str]] = mapped_column(String(255))
ja_name: Mapped[Optional[str]] = mapped_column(String(255))
href: Mapped[Optional[str]] = mapped_column(String(255))
details: Mapped[Optional[str]] = mapped_column(Text)
uncensored: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
from_list: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
from_movie_list: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
movies_cnt: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
magnet_cnt: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
class JavbusStudios(Base):
__tablename__ = 'javbus_studios'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
name: Mapped[Optional[str]] = mapped_column(String(255))
en_name: Mapped[Optional[str]] = mapped_column(String(255))
ja_name: Mapped[Optional[str]] = mapped_column(String(255))
href: Mapped[Optional[str]] = mapped_column(String(255))
details: Mapped[Optional[str]] = mapped_column(Text)
uncensored: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
from_list: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
from_movie_list: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
movies_cnt: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
magnet_cnt: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
class JavbusTags(Base):
__tablename__ = 'javbus_tags'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
name: Mapped[Optional[str]] = mapped_column(String(255))
en_name: Mapped[Optional[str]] = mapped_column(String(255))
ja_name: Mapped[Optional[str]] = mapped_column(String(255))
href: Mapped[Optional[str]] = mapped_column(String(255))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
javbus_movies_tags: Mapped[List['JavbusMoviesTags']] = relationship('JavbusMoviesTags', back_populates='tag')
class JavdbActors(Base):
__tablename__ = 'javdb_actors'
name: Mapped[str] = mapped_column(Text)
href: Mapped[str] = mapped_column(Text, unique=True)
is_full_data: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_actor_list: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_movie_list: Mapped[int] = mapped_column(Integer, server_default=text('0'))
movies_cnt: Mapped[int] = mapped_column(Integer, server_default=text('0'))
uncensored: Mapped[int] = mapped_column(Integer, server_default=text('0'))
id: Mapped[Optional[int]] = mapped_column(Integer, primary_key=True)
pic: Mapped[Optional[str]] = mapped_column(Text)
created_at: Mapped[Optional[datetime.datetime]] = mapped_column(DateTime, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[datetime.datetime]] = mapped_column(DateTime, server_default=text("datetime('now', 'localtime')"))
javdb_actors_alias: Mapped[List['JavdbActorsAlias']] = relationship('JavdbActorsAlias', back_populates='actor')
javdb_actors_movies: Mapped[List['JavdbActorsMovies']] = relationship('JavdbActorsMovies', back_populates='actor')
class JavdbMakers(Base):
__tablename__ = 'javdb_makers'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
name: Mapped[str] = mapped_column(String(255))
href: Mapped[Optional[str]] = mapped_column(String(255))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
details: Mapped[Optional[str]] = mapped_column(Text)
from_list: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
from_movie_list: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
class JavdbMovies(Base):
__tablename__ = 'javdb_movies'
is_full_data: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_actor_list: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_movie_makers: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_movie_series: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_movie_publishers: Mapped[int] = mapped_column(Integer, server_default=text('0'))
uncensored: Mapped[int] = mapped_column(Integer, server_default=text('0'))
id: Mapped[Optional[int]] = mapped_column(Integer, primary_key=True)
href: Mapped[Optional[str]] = mapped_column(Text, unique=True)
title: Mapped[Optional[str]] = mapped_column(Text)
cover_url: Mapped[Optional[str]] = mapped_column(Text)
serial_number: Mapped[Optional[str]] = mapped_column(Text)
release_date: Mapped[Optional[str]] = mapped_column(Text)
duration: Mapped[Optional[str]] = mapped_column(Text)
maker_id: Mapped[Optional[str]] = mapped_column(Text)
series_id: Mapped[Optional[str]] = mapped_column(Text)
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
pub_id: Mapped[Optional[int]] = mapped_column(Integer)
javdb_actors_movies: Mapped[List['JavdbActorsMovies']] = relationship('JavdbActorsMovies', back_populates='movie')
javdb_movies_tags: Mapped[List['JavdbMoviesTags']] = relationship('JavdbMoviesTags', back_populates='movie')
class JavdbPublishers(Base):
__tablename__ = 'javdb_publishers'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
name: Mapped[str] = mapped_column(String(255))
href: Mapped[Optional[str]] = mapped_column(String(255))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
details: Mapped[Optional[str]] = mapped_column(Text)
from_list: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
from_movie_list: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
class JavdbSeries(Base):
__tablename__ = 'javdb_series'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
name: Mapped[str] = mapped_column(String(255))
href: Mapped[Optional[str]] = mapped_column(String(255))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
details: Mapped[Optional[str]] = mapped_column(Text)
from_list: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
from_movie_list: Mapped[Optional[int]] = mapped_column(Integer, server_default=text('0'))
class JavdbTags(Base):
__tablename__ = 'javdb_tags'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
name: Mapped[str] = mapped_column(String(255))
href: Mapped[Optional[str]] = mapped_column(String(255))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
javdb_movies_tags: Mapped[List['JavdbMoviesTags']] = relationship('JavdbMoviesTags', back_populates='tag')
class JavdbTaskLog(Base):
__tablename__ = 'javdb_task_log'
task_id: Mapped[int] = mapped_column(Integer, primary_key=True)
full_data_actors: Mapped[Optional[int]] = mapped_column(Integer)
total_actors: Mapped[Optional[int]] = mapped_column(Integer)
full_data_movies: Mapped[Optional[int]] = mapped_column(Integer)
total_movies: Mapped[Optional[int]] = mapped_column(Integer)
total_makers: Mapped[Optional[int]] = mapped_column(Integer)
total_series: Mapped[Optional[int]] = mapped_column(Integer)
task_status: Mapped[Optional[str]] = mapped_column(String(255))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
class JavhdModels(Base):
__tablename__ = 'javhd_models'
is_full_data: Mapped[int] = mapped_column(Integer, server_default=text('0'))
id: Mapped[Optional[int]] = mapped_column(Integer, primary_key=True)
rank: Mapped[Optional[int]] = mapped_column(Integer)
ja_name: Mapped[Optional[str]] = mapped_column(Text)
zh_name: Mapped[Optional[str]] = mapped_column(Text)
en_name: Mapped[Optional[str]] = mapped_column(Text)
url: Mapped[Optional[str]] = mapped_column(Text, unique=True)
pic: Mapped[Optional[str]] = mapped_column(Text)
height: Mapped[Optional[str]] = mapped_column(Text)
weight: Mapped[Optional[str]] = mapped_column(Text)
breast_size: Mapped[Optional[str]] = mapped_column(Text)
breast_factor: Mapped[Optional[str]] = mapped_column(Text)
hair_color: Mapped[Optional[str]] = mapped_column(Text)
eye_color: Mapped[Optional[str]] = mapped_column(Text)
birth_date: Mapped[Optional[str]] = mapped_column(Text)
ethnicity: Mapped[Optional[str]] = mapped_column(Text)
birth_place: Mapped[Optional[str]] = mapped_column(Text)
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
class PboxActors(Base):
__tablename__ = 'pbox_actors'
name: Mapped[str] = mapped_column(Text)
movies_cnt: Mapped[int] = mapped_column(Integer, server_default=text('0'))
is_full_data: Mapped[int] = mapped_column(Integer, server_default=text('0'))
id: Mapped[Optional[int]] = mapped_column(Integer, primary_key=True)
href: Mapped[Optional[str]] = mapped_column(Text, unique=True)
gender: Mapped[Optional[str]] = mapped_column(Text)
age: Mapped[Optional[int]] = mapped_column(Integer)
nationality: Mapped[Optional[str]] = mapped_column(Text)
country: Mapped[Optional[str]] = mapped_column(Text)
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
pbox_actor_aliases: Mapped[List['PboxActorAliases']] = relationship('PboxActorAliases', back_populates='actor')
pbox_actors_movies: Mapped[List['PboxActorsMovies']] = relationship('PboxActorsMovies', back_populates='actor')
class PboxStudios(Base):
__tablename__ = 'pbox_studios'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
name: Mapped[str] = mapped_column(String(255))
label_id: Mapped[int] = mapped_column(Integer, server_default=text('0'))
scene_count: Mapped[int] = mapped_column(Integer, server_default=text('0'))
href: Mapped[Optional[str]] = mapped_column(String(255))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
description: Mapped[Optional[str]] = mapped_column(Text)
pbox_movies: Mapped[List['PboxMovies']] = relationship('PboxMovies', back_populates='studio')
class PboxTags(Base):
__tablename__ = 'pbox_tags'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
name: Mapped[str] = mapped_column(String(255))
href: Mapped[Optional[str]] = mapped_column(String(255))
tag_id: Mapped[Optional[int]] = mapped_column(Integer)
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
pbox_movies_tags: Mapped[List['PboxMoviesTags']] = relationship('PboxMoviesTags', back_populates='tag')
class ThelordofpornActress(Base):
__tablename__ = 'thelordofporn_actress'
is_full_data: Mapped[int] = mapped_column(Integer, server_default=text('0'))
id: Mapped[Optional[int]] = mapped_column(Integer, primary_key=True)
pornstar: Mapped[Optional[str]] = mapped_column(Text)
rating: Mapped[Optional[float]] = mapped_column(REAL)
rank: Mapped[Optional[int]] = mapped_column(Integer)
votes: Mapped[Optional[int]] = mapped_column(Integer)
href: Mapped[Optional[str]] = mapped_column(Text, unique=True)
career_start: Mapped[Optional[str]] = mapped_column(Text)
measurements: Mapped[Optional[str]] = mapped_column(Text)
born: Mapped[Optional[str]] = mapped_column(Text)
height: Mapped[Optional[str]] = mapped_column(Text)
weight: Mapped[Optional[str]] = mapped_column(Text)
date_modified: Mapped[Optional[str]] = mapped_column(Text)
global_rank: Mapped[Optional[int]] = mapped_column(Integer)
weekly_rank: Mapped[Optional[int]] = mapped_column(Integer)
last_month_rating: Mapped[Optional[float]] = mapped_column(REAL)
current_rating: Mapped[Optional[float]] = mapped_column(REAL)
total_votes: Mapped[Optional[int]] = mapped_column(Integer)
birth_date: Mapped[Optional[str]] = mapped_column(Text)
birth_year: Mapped[Optional[str]] = mapped_column(Text)
birth_place: Mapped[Optional[str]] = mapped_column(Text)
height_ft: Mapped[Optional[str]] = mapped_column(Text)
height_cm: Mapped[Optional[str]] = mapped_column(Text)
weight_lbs: Mapped[Optional[str]] = mapped_column(Text)
weight_kg: Mapped[Optional[str]] = mapped_column(Text)
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
thelordofporn_alias: Mapped[List['ThelordofpornAlias']] = relationship('ThelordofpornAlias', back_populates='actress')
class IafdMovies(Base):
__tablename__ = 'iafd_movies'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
is_full_data: Mapped[int] = mapped_column(Integer, server_default=text('0'))
release_year: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_performer_list: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_dist_list: Mapped[int] = mapped_column(Integer, server_default=text('0'))
from_stu_list: Mapped[int] = mapped_column(Integer, server_default=text('0'))
title: Mapped[Optional[str]] = mapped_column(String(255))
minutes: Mapped[Optional[str]] = mapped_column(String(255))
distributor_id: Mapped[Optional[int]] = mapped_column(ForeignKey('iafd_distributors.id'))
studio_id: Mapped[Optional[int]] = mapped_column(ForeignKey('iafd_studios.id'))
release_date: Mapped[Optional[str]] = mapped_column(String(255))
added_to_IAFD_date: Mapped[Optional[str]] = mapped_column(String(255))
all_girl: Mapped[Optional[str]] = mapped_column(String(255))
all_male: Mapped[Optional[str]] = mapped_column(String(255))
compilation: Mapped[Optional[str]] = mapped_column(String(255))
webscene: Mapped[Optional[str]] = mapped_column(String(255))
director_id: Mapped[Optional[int]] = mapped_column(Integer)
href: Mapped[Optional[str]] = mapped_column(String(255))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
distributor: Mapped[Optional['IafdDistributors']] = relationship('IafdDistributors', back_populates='iafd_movies')
studio: Mapped[Optional['IafdStudios']] = relationship('IafdStudios', back_populates='iafd_movies')
iafd_movies_appers_in: Mapped[List['IafdMoviesAppersIn']] = relationship('IafdMoviesAppersIn', foreign_keys='[IafdMoviesAppersIn.appears_in_id]', back_populates='appears_in')
iafd_movies_appers_in_: Mapped[List['IafdMoviesAppersIn']] = relationship('IafdMoviesAppersIn', foreign_keys='[IafdMoviesAppersIn.movie_id]', back_populates='movie')
iafd_performers_movies: Mapped[List['IafdPerformersMovies']] = relationship('IafdPerformersMovies', back_populates='movie')
class IafdPerformerAliases(Base):
__tablename__ = 'iafd_performer_aliases'
performer_id: Mapped[int] = mapped_column(ForeignKey('iafd_performers.id'), primary_key=True)
alias: Mapped[str] = mapped_column(String(255), primary_key=True)
performer: Mapped['IafdPerformers'] = relationship('IafdPerformers', back_populates='iafd_performer_aliases')
class IafdPerformerUrls(Base):
__tablename__ = 'iafd_performer_urls'
performer_id: Mapped[int] = mapped_column(ForeignKey('iafd_performers.id'), primary_key=True)
position: Mapped[str] = mapped_column(String(255), primary_key=True)
url: Mapped[str] = mapped_column(String(255), primary_key=True)
performer: Mapped['IafdPerformers'] = relationship('IafdPerformers', back_populates='iafd_performer_urls')
class JavbusActorsMovies(Base):
__tablename__ = 'javbus_actors_movies'
__table_args__ = (
Index('idx_actor_movie_actor_id', 'actor_id'),
)
actor_id: Mapped[Optional[int]] = mapped_column(ForeignKey('javbus_actors.id'), primary_key=True)
movie_id: Mapped[Optional[int]] = mapped_column(ForeignKey('javbus_movies.id'), primary_key=True)
tags: Mapped[Optional[str]] = mapped_column(Text)
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
actor: Mapped[Optional['JavbusActors']] = relationship('JavbusActors', back_populates='javbus_actors_movies')
movie: Mapped[Optional['JavbusMovies']] = relationship('JavbusMovies', back_populates='javbus_actors_movies')
class JavbusMoviesTags(Base):
__tablename__ = 'javbus_movies_tags'
movie_id: Mapped[Optional[int]] = mapped_column(ForeignKey('javbus_movies.id'), primary_key=True)
tag_id: Mapped[Optional[int]] = mapped_column(ForeignKey('javbus_tags.id'), primary_key=True)
tags: Mapped[Optional[str]] = mapped_column(Text)
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
movie: Mapped[Optional['JavbusMovies']] = relationship('JavbusMovies', back_populates='javbus_movies_tags')
tag: Mapped[Optional['JavbusTags']] = relationship('JavbusTags', back_populates='javbus_movies_tags')
class JavdbActorsAlias(Base):
__tablename__ = 'javdb_actors_alias'
actor_id: Mapped[int] = mapped_column(ForeignKey('javdb_actors.id', ondelete='CASCADE'), primary_key=True)
alias: Mapped[str] = mapped_column(Text, primary_key=True)
created_at: Mapped[Optional[datetime.datetime]] = mapped_column(DateTime, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[datetime.datetime]] = mapped_column(DateTime, server_default=text("datetime('now', 'localtime')"))
actor: Mapped['JavdbActors'] = relationship('JavdbActors', back_populates='javdb_actors_alias')
class JavdbActorsMovies(Base):
__tablename__ = 'javdb_actors_movies'
actor_id: Mapped[Optional[int]] = mapped_column(ForeignKey('javdb_actors.id'), primary_key=True)
movie_id: Mapped[Optional[int]] = mapped_column(ForeignKey('javdb_movies.id'), primary_key=True)
tags: Mapped[Optional[str]] = mapped_column(Text)
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text)
actor: Mapped[Optional['JavdbActors']] = relationship('JavdbActors', back_populates='javdb_actors_movies')
movie: Mapped[Optional['JavdbMovies']] = relationship('JavdbMovies', back_populates='javdb_actors_movies')
class JavdbMoviesTags(Base):
__tablename__ = 'javdb_movies_tags'
movie_id: Mapped[Optional[int]] = mapped_column(ForeignKey('javdb_movies.id'), primary_key=True)
tag_id: Mapped[Optional[int]] = mapped_column(ForeignKey('javdb_tags.id'), primary_key=True)
tags: Mapped[Optional[str]] = mapped_column(Text)
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
movie: Mapped[Optional['JavdbMovies']] = relationship('JavdbMovies', back_populates='javdb_movies_tags')
tag: Mapped[Optional['JavdbTags']] = relationship('JavdbTags', back_populates='javdb_movies_tags')
class PboxActorAliases(Base):
__tablename__ = 'pbox_actor_aliases'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
actor_id: Mapped[int] = mapped_column(ForeignKey('pbox_actors.id'))
alias: Mapped[str] = mapped_column(String(255))
actor_alias: Mapped[Optional[str]] = mapped_column(String(255))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
actor: Mapped['PboxActors'] = relationship('PboxActors', back_populates='pbox_actor_aliases')
class PboxMovies(Base):
__tablename__ = 'pbox_movies'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
is_full_data: Mapped[int] = mapped_column(Integer, server_default=text('0'))
href: Mapped[Optional[str]] = mapped_column(String(255))
title: Mapped[Optional[str]] = mapped_column(String(255))
movie_id: Mapped[Optional[int]] = mapped_column(Integer)
content_id: Mapped[Optional[int]] = mapped_column(Integer)
duration: Mapped[Optional[str]] = mapped_column(String(255))
publish_date: Mapped[Optional[str]] = mapped_column(String(255))
release_date: Mapped[Optional[str]] = mapped_column(String(255))
studio_id: Mapped[Optional[int]] = mapped_column(ForeignKey('pbox_studios.id'))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
studio: Mapped[Optional['PboxStudios']] = relationship('PboxStudios', back_populates='pbox_movies')
pbox_actors_movies: Mapped[List['PboxActorsMovies']] = relationship('PboxActorsMovies', back_populates='movie')
pbox_movies_alts: Mapped[List['PboxMoviesAlts']] = relationship('PboxMoviesAlts', foreign_keys='[PboxMoviesAlts.max_mov_id]', back_populates='max_mov')
pbox_movies_alts_: Mapped[List['PboxMoviesAlts']] = relationship('PboxMoviesAlts', foreign_keys='[PboxMoviesAlts.min_mov_id]', back_populates='min_mov')
pbox_movies_tags: Mapped[List['PboxMoviesTags']] = relationship('PboxMoviesTags', back_populates='movie')
class ThelordofpornAlias(Base):
__tablename__ = 'thelordofporn_alias'
actress_id: Mapped[int] = mapped_column(ForeignKey('thelordofporn_actress.id', ondelete='CASCADE'), primary_key=True)
alias: Mapped[str] = mapped_column(Text, primary_key=True)
updated_at: Mapped[Optional[str]] = mapped_column(Text)
actress: Mapped['ThelordofpornActress'] = relationship('ThelordofpornActress', back_populates='thelordofporn_alias')
class IafdMoviesAppersIn(Base):
__tablename__ = 'iafd_movies_appers_in'
movie_id: Mapped[Optional[int]] = mapped_column(ForeignKey('iafd_movies.id'), primary_key=True)
appears_in_id: Mapped[Optional[int]] = mapped_column(ForeignKey('iafd_movies.id'), primary_key=True)
gradation: Mapped[Optional[int]] = mapped_column(Integer)
notes: Mapped[Optional[str]] = mapped_column(String(255))
appears_in: Mapped[Optional['IafdMovies']] = relationship('IafdMovies', foreign_keys=[appears_in_id], back_populates='iafd_movies_appers_in')
movie: Mapped[Optional['IafdMovies']] = relationship('IafdMovies', foreign_keys=[movie_id], back_populates='iafd_movies_appers_in_')
class IafdPerformersMovies(Base):
__tablename__ = 'iafd_performers_movies'
__table_args__ = (
Index('idx_iafd_performers_movies_performer_id', 'performer_id'),
)
performer_id: Mapped[Optional[int]] = mapped_column(ForeignKey('iafd_performers.id'), primary_key=True)
movie_id: Mapped[Optional[int]] = mapped_column(ForeignKey('iafd_movies.id'), primary_key=True)
role: Mapped[Optional[str]] = mapped_column(String(255))
notes: Mapped[Optional[str]] = mapped_column(String(255))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
movie: Mapped[Optional['IafdMovies']] = relationship('IafdMovies', back_populates='iafd_performers_movies')
performer: Mapped[Optional['IafdPerformers']] = relationship('IafdPerformers', back_populates='iafd_performers_movies')
class PboxActorsMovies(Base):
__tablename__ = 'pbox_actors_movies'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
actor_id: Mapped[Optional[int]] = mapped_column(ForeignKey('pbox_actors.id'))
movie_id: Mapped[Optional[int]] = mapped_column(ForeignKey('pbox_movies.id'))
actor_mov: Mapped[Optional[str]] = mapped_column(String(255))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
tags: Mapped[Optional[str]] = mapped_column(Text)
actor: Mapped[Optional['PboxActors']] = relationship('PboxActors', back_populates='pbox_actors_movies')
movie: Mapped[Optional['PboxMovies']] = relationship('PboxMovies', back_populates='pbox_actors_movies')
class PboxMoviesAlts(Base):
__tablename__ = 'pbox_movies_alts'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
min_mov_id: Mapped[Optional[int]] = mapped_column(ForeignKey('pbox_movies.id'))
max_mov_id: Mapped[Optional[int]] = mapped_column(ForeignKey('pbox_movies.id'))
min_max: Mapped[Optional[str]] = mapped_column(String(255))
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
max_mov: Mapped[Optional['PboxMovies']] = relationship('PboxMovies', foreign_keys=[max_mov_id], back_populates='pbox_movies_alts')
min_mov: Mapped[Optional['PboxMovies']] = relationship('PboxMovies', foreign_keys=[min_mov_id], back_populates='pbox_movies_alts_')
class PboxMoviesTags(Base):
__tablename__ = 'pbox_movies_tags'
id: Mapped[int] = mapped_column(Integer, primary_key=True)
movie_id: Mapped[Optional[int]] = mapped_column(ForeignKey('pbox_movies.id'))
tag_id: Mapped[Optional[int]] = mapped_column(ForeignKey('pbox_tags.id'))
movid_tagid: Mapped[Optional[str]] = mapped_column(String(255))
tags: Mapped[Optional[str]] = mapped_column(Text)
created_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
updated_at: Mapped[Optional[str]] = mapped_column(Text, server_default=text("datetime('now', 'localtime')"))
movie: Mapped[Optional['PboxMovies']] = relationship('PboxMovies', back_populates='pbox_movies_tags')
tag: Mapped[Optional['PboxTags']] = relationship('PboxTags', back_populates='pbox_movies_tags')

View File

@ -0,0 +1,55 @@
# 从数据库生成模型类
sqlacodegen sqlite:////root/sharedata/sqlite/shared.db > models/shared.py
sqlacodegen sqlite:////root/sharedata/sqlite/scrapy.db > models/scrapy.py
# 初始化
alembic init migrations/shared_comm
alembic init migrations/scrapy
alembic init migrations/testdb
# 同步修改到数据库(读取 models/shared.py
./scripts/sync_shared_comm.sh
./scripts/reset_testdb.sh
### 对视图支持不好,主要是视图的字段没有类型,所以在导入导出时会出错,慎用!
------------------------- 清理掉无法处理的字段 --------------------
PRAGMA foreign_keys = OFF; -- 禁用外键检查
-- 检查字段是否已删除
PRAGMA table_info(javdb_series); -- 应看不到parent_id字段
-- 验证数据完整性
SELECT COUNT(*), MIN(id), MAX(id) FROM javdb_series; -- 数量应与操作前一致
-- 5. 处理 javdb_series 表
CREATE TABLE "javdb_series_new" (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`name` VARCHAR(255) NOT NULL,
`href` VARCHAR(255) UNIQUE,
`created_at` TEXT DEFAULT (datetime('now', 'localtime')),
`updated_at` TEXT DEFAULT (datetime('now', 'localtime')),
`details` TEXT,
from_list INTEGER DEFAULT (0),
from_movie_list INTEGER DEFAULT (0)
);
INSERT INTO javdb_series_new (id, name, href, created_at, updated_at, details, from_list, from_movie_list)
SELECT id, name, href, created_at, updated_at, details, from_list, from_movie_list
FROM javdb_series;
DROP TABLE javdb_series;
ALTER TABLE javdb_series_new RENAME TO javdb_series;
-- 检查字段是否已删除
PRAGMA table_info(javdb_series); -- 应看不到parent_id字段
-- 验证数据完整性
SELECT COUNT(*), MIN(id), MAX(id) FROM javdb_series; -- 数量应与操作前一致
PRAGMA foreign_keys = ON; -- 恢复外键检查

View File

@ -0,0 +1,6 @@
# requirements.txt
sqlalchemy>=2.0.0
alembic>=1.12.0
sqlacodegen>=3.0.0
# pip install -r requirements.txt

View File

@ -0,0 +1,14 @@
#!/bin/bash
cd $(dirname $0)/..
# 删除测试库文件
#rm -f /root/sharedata/sqlite/test.db
# 重新创建并应用最新迁移
alembic -c migrations/testdb/alembic.ini revision --autogenerate -m "Initial test schema"
alembic -c migrations/testdb/alembic.ini upgrade head
# 回滚数据库A到上一版本
# alembic -c migrations/testdb/alembic.ini downgrade -1
echo "测试库已重置并生成最新表结构"

View File

@ -0,0 +1,7 @@
#!/bin/bash
cd $(dirname $0)/..
alembic -c migrations/scrapy/alembic.ini revision --autogenerate -m "Auto update from scrapy"
alembic -c migrations/scrapy/alembic.ini upgrade head
echo "数据库 scrapy 同步完成"

View File

@ -0,0 +1,10 @@
#!/bin/bash
cd $(dirname $0)/.. # 切换到tools目录
# 生成迁移脚本
alembic -c migrations/shared_comm/alembic.ini revision --autogenerate -m "Auto update from shared_comm"
# 执行迁移
alembic -c migrations/shared_comm/alembic.ini upgrade head
echo "数据库 shared 同步完成"