mirror of
https://github.com/Xevion/linkpulse.git
synced 2025-12-06 03:15:35 -06:00
wrote migrations for 001_initial.py
This commit is contained in:
@@ -39,8 +39,13 @@ def migrate(migrator: Migrator, database: pw.Database, *, fake=False):
|
||||
|
||||
@migrator.create_model
|
||||
class IPAddress(pw.Model):
|
||||
ip = pw.CharField(max_length=255, primary_key=True)
|
||||
lastSeen = pw.DateTimeField()
|
||||
|
||||
"""wrote a generic script... hope one of you can test it for me bc its still not working on my machine"""
|
||||
ip = pw.CharField(max_length=255, primary_key=True, help_text="The IP address (primary key).")
|
||||
lastSeen = pw.DateTimeField(help_text="Timestamp of the last activity from this IP address.")
|
||||
location = pw.CharField(max_length=100, null=True, help_text="Optional location information.")
|
||||
is_blocked = pw.BooleanField(default=False, help_text="Indicates whether the IP is blocked.")
|
||||
created_at = pw.DateTimeField(constraints=[pw.SQL("DEFAULT CURRENT_TIMESTAMP")], help_text="Record creation time.")
|
||||
|
||||
class Meta:
|
||||
table_name = "ipaddress"
|
||||
|
||||
@@ -25,25 +25,30 @@ Some examples (model - class or model name)::
|
||||
"""
|
||||
|
||||
from contextlib import suppress
|
||||
|
||||
import peewee as pw
|
||||
from peewee_migrate import Migrator
|
||||
|
||||
|
||||
with suppress(ImportError):
|
||||
import playhouse.postgres_ext as pw_pext
|
||||
|
||||
|
||||
def migrate(migrator: Migrator, database: pw.Database, *, fake=False):
|
||||
"""Write your migrations here."""
|
||||
"""
|
||||
Add a 'count' field to the 'ipaddress' table.
|
||||
|
||||
The new field:
|
||||
- Name: count
|
||||
- Type: IntegerField
|
||||
- Default: 0
|
||||
"""
|
||||
migrator.add_fields(
|
||||
'ipaddress',
|
||||
|
||||
count=pw.IntegerField(default=0))
|
||||
count=pw.IntegerField(default=0)
|
||||
)
|
||||
|
||||
|
||||
def rollback(migrator: Migrator, database: pw.Database, *, fake=False):
|
||||
"""Write your rollback migrations here."""
|
||||
|
||||
"""
|
||||
Remove the 'count' field from the 'ipaddress' table.
|
||||
"""
|
||||
migrator.remove_fields('ipaddress', 'count')
|
||||
|
||||
5700
frontend/package-lock.json
generated
Normal file
5700
frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -46,7 +46,7 @@
|
||||
"tailwindcss": "^3.4.14",
|
||||
"typescript": "~5.6.2",
|
||||
"typescript-eslint": "^8.11.0",
|
||||
"vite": "^5.4.10",
|
||||
"vite": "^5.4.11",
|
||||
"vitest": "^2.1.4"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user