Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: php spark make: migration--session, "timestamp" column type #4827

Closed
tomomo opened this issue Jun 12, 2021 · 1 comment · Fixed by #4877
Closed

Bug: php spark make: migration--session, "timestamp" column type #4827

tomomo opened this issue Jun 12, 2021 · 1 comment · Fixed by #4877
Labels
bug Verified issues on the current code behavior or pull requests that will fix them database Issues or pull requests that affect the database layer

Comments

@tomomo
Copy link

tomomo commented Jun 12, 2021

Hello.

I noticed while reading #4807.

The documentation(https://codeigniter4.github.io/userguide/libraries/sessions.html?highlight=ci_sessions) specifies timestamp.

CREATE TABLE IF NOT EXISTS `ci_sessions` (
        `id` varchar(128) NOT NULL,
        `ip_address` varchar(45) NOT NULL,
        `timestamp` timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL,
        `data` blob NOT NULL,
        KEY `ci_sessions_timestamp` (`timestamp`)
);

But, the file created by php spark make: migration--session is an int.

class CreateCiSessionsTable extends Migration
{
	protected $DBGroup = 'default';

	public function up()
	{
		$this->forge->addField([
			'id'         => ['type' => 'VARCHAR', 'constraint' => 128, 'null' => false],
			'ip_address' => ['type' => 'VARCHAR', 'constraint' => 45, 'null' => false],
			'timestamp'  => ['type' => 'INT', 'unsigned' => true, 'null' => false, 'default' => 0],
			'data'       => ['type' => 'TEXT', 'null' => false, 'default' => ''],
		]);
		$this->forge->addKey('id', true);
		$this->forge->addKey('timestamp');
		$this->forge->createTable('ci_sessions', true);
	}
  :

Context

  • PHP version 7.4.20
  • Codeigniter 4.1.3
@tomomo tomomo added the bug Verified issues on the current code behavior or pull requests that will fix them label Jun 12, 2021
@michalsn michalsn linked a pull request Jun 26, 2021 that will close this issue
2 tasks
@MGatner MGatner added the database Issues or pull requests that affect the database layer label Jun 26, 2021
@michalsn
Copy link
Member

Resolved via #4877

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them database Issues or pull requests that affect the database layer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants