ToolJet/server/migrations/1758793442012-AddAppVersionEntity.ts
Rohan Lahori 5bec5a5b12
Feature/draft versioning support (#14284)
* added app_versions fields

* added data migration for backward compatibility

* added ce specific logic

* fixed ce migration (need to dev-test)

* moved to data migration

* migration changes

* added endpoint to create draft version

* backend changes

* added draft to app_import scenario

* added version description

* minor changes (needs improvement)

* fixed breaking dropdown in editor

* updated submodule commits

* revert package.json

* revert ui not used changes

* submodule changes

* reverting non used files

* ui changes

* ui changes

* ui changes

* ui changes

* ui changes

* copywriting changes

* ui changes

* ui changes

* edit version modal changes

* ui integration changes

* added button solid and removed unused css

* removed commented code from create version modal

* updated button size to use large

* ui changes

* draft version modal changes

* added sub-module commits to main

* draft version endpoint changes

* ui changes for draft version modal

* fix breaking ui

* ui changes for banner

* minor ui changes

* remove scss changes from themes file

* removed unused components (cleanup)

* removed unused components (pr cleanup)

* draft version changes

* create version modal changes

* canvas banner fixes

* comment creation logic

* refactor: version dropdown

* update endpoint changes

* fix: promote logic

* update submodule

* fix: released version and create version modal

* fix draft version creation

* minor ui changes

* minor backend fixes

* tooltip changes

* added all components in same folder

* added minor comments

* import fixes

* refactor files

* fix: overlay issues

* fix: on version creation

* fix ce bugs

* bug fixes

* bug fixes

* bug fixes

* bug fixes

* base merge

* feat: draft versioning support with UI enhancements and backend adjustments

- Updated AppCanvas to conditionally render AppCanvasBanner based on edit mode.
- Enhanced CreateDraftVersionModal to handle version selection and creation logic.
- Modified CreateVersionModal to streamline version creation process and handle commits.
- Improved ReleaseConfirmation to include development versions in release context.
- Refactored CreateDraftButton and VersionDropdownItem for better UI consistency and dark mode support.
- Updated VersionManagerDropdown to manage draft versions and improve version selection logic.
- Enhanced version switcher and promote/release buttons with dark mode styling.
- Adjusted server-side features and constants to support new draft versioning capabilities.
- Updated styles across components for better visual consistency and responsiveness.

* minor fixes

* rebase

* merge base

* update submodule

* Add data-cy attribute for draft version components

* Update cypress test cases for draft version feature

* Update failing test cases

* Update draft version test cases

* Skip older flow

* migration changes

* migration fixes

* Update the failed test cases

* removed multiple api calls

* fix: version set on draft creation

* fixes

* fix: version update on save version

* fixes

* name fix

* fix version lock banner styling

* bump version to 3.20.50-lts across all components

---------

Co-authored-by: Vijaykant Yadav <vjy239@gmail.com>
Co-authored-by: ajith-k-v <ajith.jaban@gmail.com>
Co-authored-by: gsmithun4 <gsmithun4@gmail.com>
2025-12-05 22:13:00 +05:30

74 lines
No EOL
2.5 KiB
TypeScript

import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm';
export class AddAppVersionEntity1758793442012 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
// Add parent_version_id column
await queryRunner.addColumn(
'app_versions',
new TableColumn({
name: 'parent_version_id',
type: 'uuid',
isNullable: true,
})
);
// Create enum type for version status if it doesn't exist
await queryRunner.query(`
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'version_status_enum') THEN
CREATE TYPE version_status_enum AS ENUM ('DRAFT', 'PUBLISHED');
END IF;
END$$;
`);
// Add Version status column
await queryRunner.addColumn(
'app_versions',
new TableColumn({
name: 'status',
type: 'version_status_enum',
isNullable: true,
})
);
// Add description column
await queryRunner.addColumn(
'app_versions',
new TableColumn({
name: 'description',
type: 'varchar',
length: '500',
isNullable: true,
})
);
// Add published_at column
await queryRunner.addColumn(
'app_versions',
new TableColumn({
name: 'published_at',
type: 'timestamp',
isNullable: true,
})
);
// Add released_at column
await queryRunner.addColumn(
'app_versions',
new TableColumn({
name: 'released_at',
type: 'timestamp',
isNullable: true,
})
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
// Remove the columns and enum from the app_versions table
await queryRunner.dropColumn('app_versions', 'released_at');
await queryRunner.dropColumn('app_versions', 'published_at');
await queryRunner.dropColumn('app_versions', 'description');
await queryRunner.dropColumn('app_versions', 'status');
await queryRunner.dropColumn('app_versions', 'parent_version_id');
await queryRunner.query(`DROP TYPE IF EXISTS version_status_enum;`);
}
}