nova-horizons / realoquent

Realoquent: Laravel Database Schema and Model Generator
MIT License
4 stars 0 forks source link

Unknown DB type: timestamp without time zone [PostgresQL] #163

Open tansautn opened 1 week ago

tansautn commented 1 week ago

Realoquent Version

0.6.0

Laravel Version

11.27.2

PHP Version

8.2.24

Operating System & Version

Debian 11

Database Type & Version

Postgres 16.4 (Debian 16.4-1.pgdg110+2)

Description

Step in setup schema then i got bellow exception:

[2024-10-13 20:27:35] development.ERROR: Unknown DB type: timestamp without time zone {"exception":"[object] (RuntimeException(code: 0): Unknown DB type: timestamp without time zone at /var/_www/fitly/vendor/nova-horizons/realoquent/src/TypeDetector.php:115)
[stacktrace]
#0 /var/_www/fitly/vendor/nova-horizons/realoquent/src/TypeDetector.php(22): NovaHorizons\\Realoquent\\TypeDetector::fromPostgreSQL()
#1 /var/_www/fitly/vendor/nova-horizons/realoquent/src/DatabaseAnalyzer.php(28): NovaHorizons\\Realoquent\\TypeDetector::fromDB()
#2 /var/_www/fitly/vendor/nova-horizons/realoquent/src/DataObjects/Table.php(262): NovaHorizons\\Realoquent\\DatabaseAnalyzer::getColumns()
#3 /var/_www/fitly/vendor/nova-horizons/realoquent/src/SchemaManager.php(28): NovaHorizons\\Realoquent\\DataObjects\\Table::fromDB()
#4 /var/_www/fitly/vendor/nova-horizons/realoquent/src/RealoquentManager.php(84): NovaHorizons\\Realoquent\\SchemaManager->rebuildSchema()
#5 /var/_www/fitly/vendor/nova-horizons/realoquent/src/RealoquentManager.php(75): NovaHorizons\\Realoquent\\RealoquentManager->generateSchema()
#6 /var/_www/fitly/vendor/nova-horizons/realoquent/src/Commands/GenerateSchema.php(36): NovaHorizons\\Realoquent\\RealoquentManager->generateAndWriteSchema()
#7 /var/_www/fitly/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): NovaHorizons\\Realoquent\\Commands\\GenerateSchema->handle()
#8 /var/_www/fitly/vendor/laravel/framework/src/Illuminate/Container/Util.php(43): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#9 /var/_www/fitly/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(95): Illuminate\\Container\\Util::unwrapIfClosure()
#10 /var/_www/fitly/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#11 /var/_www/fitly/vendor/laravel/framework/src/Illuminate/Container/Container.php(690): Illuminate\\Container\\BoundMethod::call()
#12 /var/_www/fitly/vendor/laravel/framework/src/Illuminate/Console/Command.php(213): Illuminate\\Container\\Container->call()
#13 /var/_www/fitly/vendor/symfony/console/Command/Command.php(279): Illuminate\\Console\\Command->execute()
#14 /var/_www/fitly/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Symfony\\Component\\Console\\Command\\Command->run()
#15 /var/_www/fitly/vendor/symfony/console/Application.php(1047): Illuminate\\Console\\Command->run()
#16 /var/_www/fitly/vendor/symfony/console/Application.php(316): Symfony\\Component\\Console\\Application->doRunCommand()
#17 /var/_www/fitly/vendor/symfony/console/Application.php(167): Symfony\\Component\\Console\\Application->doRun()
#18 /var/_www/fitly/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(197): Symfony\\Component\\Console\\Application->run()
#19 /var/_www/fitly/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1203): Illuminate\\Foundation\\Console\\Kernel->handle()
#20 /var/_www/fitly/artisan(13): Illuminate\\Foundation\\Application->handleCommand()
#21 {main}

here is one of my table have timestamp column that existing on DB.

CREATE TABLE accounts (
    id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    site_id BIGINT NOT NULL, -- Liên kết với bảng bet_sites
    username VARCHAR(255) NOT NULL,
    pwd VARCHAR(255) NOT NULL, 
    email VARCHAR(255),
    phone VARCHAR(50),
    reg_at TIMESTAMP,
    last_login_at TIMESTAMP, -- Thời gian đăng nhập lần cuối
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (site_id) REFERENCES bet_sites(id)
);
CREATE INDEX idx_accounts_site_id ON accounts(site_id);
CREATE INDEX idx_accounts_username ON accounts(username);
CREATE INDEX idx_accounts_email ON accounts(email);
CREATE INDEX idx_accounts_phone ON accounts(phone);
pb30 commented 2 days ago

Apologies for the delay, just published v0.7.0. Let me know if that resolves the issue. I haven't done much real-word testing with Postgres yet, so let me know if any other problems pop up, or any other thoughts you have about this library.