or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

bean-management.mddatabase-orm.mddatabase-upgrades.mdframework-integration.mdindex.mdlifecycle-events.mdportlet-framework.mdservice-layer.mdtemplate-processing.mdutility-services.mdweb-security.md

database-upgrades.mddocs/

0

# Database Upgrades

1

2

Version-specific database migration utilities supporting upgrades between Liferay 7.x versions with comprehensive schema transformation capabilities and data migration procedures.

3

4

## Capabilities

5

6

### Upgrade Utilities

7

8

Common utilities for database schema upgrades and data migrations.

9

10

```java { .api }

11

/**

12

* Base upgrade process providing common upgrade functionality

13

*/

14

public abstract class UpgradeProcess {

15

16

/**

17

* Executes the upgrade process

18

* @throws UpgradeException if upgrade fails

19

*/

20

public abstract void upgrade() throws UpgradeException;

21

22

/**

23

* Gets upgrade step description

24

* @return description of what this upgrade does

25

*/

26

public abstract String getDescription();

27

28

/**

29

* Checks if upgrade is applicable to current schema

30

* @return true if upgrade should be executed

31

*/

32

protected boolean isApplicable();

33

34

/**

35

* Executes SQL statements for schema changes

36

* @param sql SQL statements to execute

37

* @throws SQLException if SQL execution fails

38

*/

39

protected void runSQL(String... sql) throws SQLException;

40

41

/**

42

* Alters table structure

43

* @param tableName table to alter

44

* @param alterStatement SQL alter statement

45

* @throws SQLException if alter fails

46

*/

47

protected void alterTable(String tableName, String alterStatement) throws SQLException;

48

}

49

```

50

51

### Liferay 7.0.0 Upgrades

52

53

Version-specific upgrade implementations for Liferay 7.0.0 migration procedures.

54

55

```java { .api }

56

/**

57

* Upgrade processes for Liferay 7.0.0 migration

58

*/

59

public class UpgradeSchema_7_0_0 extends UpgradeProcess {

60

61

/**

62

* Upgrades database schema to Liferay 7.0.0 format

63

* @throws UpgradeException if schema upgrade fails

64

*/

65

@Override

66

public void upgrade() throws UpgradeException;

67

}

68

69

/**

70

* Data migration for Liferay 7.0.0 upgrade

71

*/

72

public class UpgradeData_7_0_0 extends UpgradeProcess {

73

74

/**

75

* Migrates data to Liferay 7.0.0 compatible format

76

* @throws UpgradeException if data migration fails

77

*/

78

@Override

79

public void upgrade() throws UpgradeException;

80

}

81

```

82

83

### Liferay 7.0.5 Upgrades

84

85

Version-specific upgrade implementations for Liferay 7.0.5 migration procedures.

86

87

```java { .api }

88

/**

89

* Upgrade processes for Liferay 7.0.5 migration

90

*/

91

public class UpgradeSchema_7_0_5 extends UpgradeProcess {

92

93

/**

94

* Upgrades database schema to Liferay 7.0.5 format

95

* @throws UpgradeException if schema upgrade fails

96

*/

97

@Override

98

public void upgrade() throws UpgradeException;

99

}

100

```

101

102

### Liferay 7.1.x Upgrades

103

104

Version-specific upgrade implementations for Liferay 7.1.x migration procedures.

105

106

```java { .api }

107

/**

108

* Upgrade processes for Liferay 7.1.x migration

109

*/

110

public class UpgradeSchema_7_1_x extends UpgradeProcess {

111

112

/**

113

* Upgrades database schema to Liferay 7.1.x format

114

* @throws UpgradeException if schema upgrade fails

115

*/

116

@Override

117

public void upgrade() throws UpgradeException;

118

}

119

```

120

121

## Usage Examples

122

123

**Running Database Upgrades:**

124

125

```java

126

// Execute upgrade process

127

UpgradeProcess upgrade = new UpgradeSchema_7_0_0();

128

if (upgrade.isApplicable()) {

129

upgrade.upgrade();

130

}

131

```

132

133

## Integration with Portal Framework

134

135

Database upgrades integrate with:

136

137

- **Portal Startup** - Automatic upgrade detection and execution

138

- **Data Migration** - Safe data transformation procedures

139

- **Schema Versioning** - Version tracking and validation

140

- **Rollback Support** - Backup and recovery procedures

141

142

## Error Handling

143

144

- **UpgradeException** - Upgrade process failures

145

- **SQLException** - Database operation errors

146

- **SchemaException** - Schema validation failures

147

- **DataMigrationException** - Data transformation errors