(cls, metadata)
| 21 | |
| 22 | @classmethod |
| 23 | def define_tables(cls, metadata): |
| 24 | global products_table, specification_table, documents_table |
| 25 | global Product, Detail, Assembly, SpecLine, Document, RasterDocument |
| 26 | |
| 27 | products_table = Table( |
| 28 | "products", |
| 29 | metadata, |
| 30 | Column( |
| 31 | "product_id", |
| 32 | Integer, |
| 33 | primary_key=True, |
| 34 | test_needs_autoincrement=True, |
| 35 | ), |
| 36 | Column("product_type", String(128)), |
| 37 | Column("name", String(128)), |
| 38 | Column("mark", String(128)), |
| 39 | ) |
| 40 | |
| 41 | specification_table = Table( |
| 42 | "specification", |
| 43 | metadata, |
| 44 | Column( |
| 45 | "spec_line_id", |
| 46 | Integer, |
| 47 | primary_key=True, |
| 48 | test_needs_autoincrement=True, |
| 49 | ), |
| 50 | Column( |
| 51 | "leader_id", |
| 52 | Integer, |
| 53 | ForeignKey("products.product_id"), |
| 54 | nullable=True, |
| 55 | ), |
| 56 | Column( |
| 57 | "follower_id", |
| 58 | Integer, |
| 59 | ForeignKey("products.product_id"), |
| 60 | nullable=True, |
| 61 | ), |
| 62 | Column("quantity", Float, default=1.0), |
| 63 | ) |
| 64 | |
| 65 | documents_table = Table( |
| 66 | "documents", |
| 67 | metadata, |
| 68 | Column( |
| 69 | "document_id", |
| 70 | Integer, |
| 71 | primary_key=True, |
| 72 | test_needs_autoincrement=True, |
| 73 | ), |
| 74 | Column("document_type", String(128)), |
| 75 | Column("product_id", Integer, ForeignKey("products.product_id")), |
| 76 | Column("create_date", DateTime, default=lambda: datetime.now()), |
| 77 | Column( |
| 78 | "last_updated", |
| 79 | DateTime, |
| 80 | default=lambda: datetime.now(), |
nothing calls this directly
no test coverage detected