Error - null pointer exception during db generation after restoring backup

I am getting null pointer exception (java.lang.NullPointerException See log file for details (C:\Users\aaa.CubaStudio2019.3\system\log\idea.log)) after i restore backup from production env to development env. This was not happening earlier (before 14 upgrade). The idea.log file is as below-

2020-08-30 18:11:47,084 [ 0] INFO - #com.intellij.idea.Main - ------------------------------------------------------ IDE STARTED ------------------------------------------------------
2020-08-30 18:11:47,156 [ 72] INFO - #com.intellij.idea.Main - IDE: CUBA Studio (build #CS-193.7288.140, 31 Jul 2020 13:30)
2020-08-30 18:11:47,157 [ 73] INFO - #com.intellij.idea.Main - OS: Windows 10 (10.0, amd64)
2020-08-30 18:11:47,157 [ 73] INFO - #com.intellij.idea.Main - JRE: 11.0.6+8-b520.66 (JetBrains s.r.o)
2020-08-30 18:11:47,157 [ 73] INFO - #com.intellij.idea.Main - JVM: 11.0.6+8-b520.66 (OpenJDK 64-Bit Server VM)
2020-08-30 18:11:47,158 [ 74] INFO - #com.intellij.idea.Main - JVM Args: exit -Xms512m -Xmx1200m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -XX:CICompilerCount=2 -Dsun.io.useCanonPrefixCache=false -Djava.net.preferIPv4Stack=true -Djdk.http.auth.tunneling.disabledSchemes=“” -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Djdk.attach.allowAttachSelf=true -Dkotlinx.coroutines.debug=off -Djdk.module.illegalAccess.silent=true -Djb.vmOptionsFile=C:\Program Files\Haulmont\CUBA Studio 2019.3\bin\cuba-studio64.exe.vmoptions -Djava.library.path=C:\Program Files\Haulmont\CUBA Studio 2019.3\jbr\bin;C:\Program Files\Haulmont\CUBA Studio 2019.3\jbr\bin\server -Didea.platform.prefix=Idea -Didea.jre.check=true -Dide.native.launcher=true -Didea.paths.selector=CubaStudio2019.3 -XX:ErrorFile=C:\Users\Umesh\java_error_in_studio_%p.log -XX:HeapDumpPath=C:\Users\Umesh\java_error_in_studio.hprof
2020-08-30 18:11:47,158 [ 74] INFO - #com.intellij.idea.Main - charsets: JNU=Cp1252 file=Cp1252
2020-08-30 18:11:47,224 [ 140] INFO - #com.intellij.idea.Main - JNA library (64-bit) loaded in 126 ms
2020-08-30 18:11:47,228 [ 144] INFO - penapi.util.io.win32.IdeaWin32 - Native filesystem for Windows is operational
2020-08-30 18:11:47,279 [ 195] INFO - ntellij.idea.ApplicationLoader - CPU cores: 8; ForkJoinPool.commonPool: java.util.concurrent.ForkJoinPool@532880fe[Running, parallelism = 7, size = 0, active = 0, running = 0, steals = 0, tasks = 0, submissions = 0]; factory: com.intellij.concurrency.IdeaForkJoinWorkerThreadFactory@7391cdbe
2020-08-30 18:11:47,463 [ 379] INFO - llij.ide.plugins.PluginManager - Plugin “Groovy” misses optional descriptor duplicates-groovy.xml
2020-08-30 18:11:47,467 [ 383] INFO - llij.ide.plugins.PluginManager - C:\Program Files\Haulmont\CUBA Studio 2019.3\plugins\cuba-studio overrides C:\Users\Umesh.CubaStudio2019.3\config\plugins\cuba-studio
2020-08-30 18:11:47,469 [ 385] INFO - llij.ide.plugins.PluginManager - Plugin “Groovy” misses optional descriptor duplicates-detection-groovy.xml
2020-08-30 18:11:47,634 [ 550] INFO - llij.ide.plugins.PluginManager - Plugin “Java” misses optional descriptor profiler-java.xml
2020-08-30 18:11:47,716 [ 632] INFO - llij.ide.plugins.PluginManager - Loaded bundled plugins: Bytecode Viewer (193.7288.140), CUBA (14.0-193), ChangeReminder (193.7288.140), Configuration Script (193.7288.140), Copyright (193.7288.140), Coverage (193.7288.140), Eclipse Interoperability (193.7288.140), EditorConfig (193.7288.140), Git (193.7288.140), GitHub (193.7288.140), Gradle (193.7288.140), Gradle-Java (193.7288.140), Gradle-Maven (193.7288.140), Groovy (193.7288.140), IDEA CORE (193.7288.140), IntelliLang (193.7288.140), JUnit (193.7288.140), Java (193.7288.140), Java Bytecode Decompiler (193.7288.140), Java IDE Customization (193.7288.140), Java Internationalization (193.7288.140), Java Stream Debugger (193.7288.140), JavaFX (193.7288.140), Kotlin (1.3.61-release-IJ2019.3-1), Machine Learning Code Completion (193.7288.140), Markdown (193.7288.140), Maven (193.7288.140), Mercurial (193.7288.140), Properties (193.7288.140), Settings Repository (193.7288.140), Shell Script (193.7288.140), Subversion (193.7288.140), Task Management (193.7288.140), Terminal (193.7288.140), TestNG (193.7288.140), TextMate bundles (193.7288.140), XPathView + XSLT (193.7288.140), XSLT Debugger (193.7288.140), YAML (193.7288.140)
2020-08-30 18:11:48,176 [ 1092] INFO - ellij.util.io.PagedFileStorage - lower=100; upper=500; buffer=10; max=1140
2020-08-30 18:11:48,190 [ 1106] INFO - tellij.util.io.FileChannelUtil - un-interruptible FileChannel-s will be used for indexes
2020-08-30 18:11:48,214 [ 1130] INFO - com.intellij.ide.ui.UISettings - Loaded: fontSize=13, fontScale=1.0; restored: fontSize=13, fontScale=1.0
2020-08-30 18:11:48,286 [ 1202] INFO - til.net.ssl.CertificateManager - Default SSL context initialized
2020-08-30 18:11:48,356 [ 1272] INFO - rains.ide.BuiltInServerManager - built-in server started, port 63342
2020-08-30 18:11:48,386 [ 1302] INFO - gs.impl.UpdateCheckerComponent - channel: release
2020-08-30 18:11:48,485 [ 1401] INFO - pl.local.NativeFileWatcherImpl - Starting file watcher: C:\Program Files\Haulmont\CUBA Studio 2019.3\bin\fsnotifier64.exe
2020-08-30 18:11:48,508 [ 1424] INFO - pl.local.NativeFileWatcherImpl - Native file watcher is operational.
2020-08-30 18:11:49,166 [ 2082] INFO - rojectCodeStyleSettingsManager - Initialized from default code style settings.
2020-08-30 18:11:49,332 [ 2248] INFO - pl$FileIndexDataInitialization - Initialization done: 1089
2020-08-30 18:11:49,450 [ 2366] INFO - exImpl$StubIndexInitialization - Initialization done: 118
2020-08-30 18:11:50,629 [ 3545] INFO - j.ide.script.IdeStartupScripts - 0 startup script(s) found
2020-08-30 18:11:51,977 [ 4893] INFO - .diagnostic.PerformanceWatcher - Post-startup activities under progress took 1138ms; general responsiveness: ok; EDT responsiveness: 1/1 sluggish
2020-08-30 18:11:51,987 [ 4903] INFO - tartup.impl.StartupManagerImpl - C:/Users/Umesh/StudioProjects/SheelLegal/.idea case-sensitivity: expected=false actual=false
2020-08-30 18:11:52,106 [ 5022] INFO - tor.impl.FileEditorManagerImpl - Project opening took 3420 ms
2020-08-30 18:11:52,492 [ 5408] INFO - .diagnostic.PerformanceWatcher - Pushing properties took 967ms; general responsiveness: ok; EDT responsiveness: ok
2020-08-30 18:11:55,251 [ 8167] INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 2757ms; general responsiveness: ok; EDT responsiveness: ok
2020-08-30 18:11:56,638 [ 9554] INFO - ct.resolve.CubaProjectResolver - CUBA project imported successfully: C:/Users/Umesh/StudioProjects/SheelLegal
2020-08-30 18:11:56,638 [ 9554] INFO - io.backend.model.StudioProject - StudioProject.incModificationCount
2020-08-30 18:11:56,674 [ 9590] INFO - nd.maven.RemoteMavenRepository - [external_req] Load file content https://dl.bintray.com/cuba-platform/main/com/haulmont/cuba/cuba-global/maven-metadata.xml
2020-08-30 18:11:56,689 [ 9605] INFO - CompilerWorkspaceConfiguration - Available processors: 8
2020-08-30 18:11:57,760 [ 10676] INFO - onents.HTTPDescriptorsProvider - Using cached C:\Users\Umesh.CubaStudio2019.3\system\cuba-studio\marketplace\available_app_components.json (updated at 8/27/2020 7:44 PM)
2020-08-30 18:11:57,901 [ 10817] INFO - j.ide.plugins.RepositoryHelper - using cached plugin list (updated at 8/30/2020 5:58 PM)
2020-08-30 18:11:59,309 [ 12225] INFO - ge.ExternalProjectsDataStorage - Load external projects data in 601 millis (read time: 588)
2020-08-30 18:11:59,446 [ 12362] INFO - org.eclipse.jetty.util.log - Logging initialized @12730ms
2020-08-30 18:11:59,504 [ 12420] INFO - rg.eclipse.jetty.server.Server - jetty-9.2.20.v20161216
2020-08-30 18:11:59,553 [ 12469] INFO - pp.StandardDescriptorProcessor - NO JSP Support for /studio, did not find org.eclipse.jetty.jsp.JettyJspServlet
2020-08-30 18:11:59,672 [ 12588] INFO - .server.handler.ContextHandler - Started o.e.j.w.WebAppContext@70ece733{/studio,file:/C:/Users/Umesh/.CubaStudio2019.3/system/,AVAILABLE}
2020-08-30 18:11:59,679 [ 12595] INFO - e.jetty.server.ServerConnector - Started ServerConnector@60f8e159{HTTP/1.1}{0.0.0.0:30200}
2020-08-30 18:11:59,679 [ 12595] INFO - rg.eclipse.jetty.server.Server - Started @12964ms
2020-08-30 18:11:59,909 [ 12825] INFO - .backend.ExternalConfigManager - [external_req] Load config https://files.cuba-platform.com/cuba/studio/studio-config.json
2020-08-30 18:12:00,133 [ 13049] INFO - tudio.backend.stat.StatManager - Sending usage statistics
2020-08-30 18:12:01,443 [ 14359] INFO - tudio.backend.stat.StatManager - Event has been sent successfully 200
2020-08-30 18:12:01,571 [ 14487] INFO - .backend.ExternalConfigManager - [external_req] Load config https://files.cuba-platform.com/cuba/studio/studio-config.json
2020-08-30 18:12:06,870 [ 19786] WARN - ndling.DefaultExceptionHandler - Studio error:
java.lang.NullPointerException
at com.haulmont.studio.backend.ed.ddl.TableUpdatesGenerator.generateEntityUpdate(TableUpdatesGenerator.java:939)
at com.haulmont.studio.backend.ed.ddl.TableUpdatesGenerator.processEntityUpdates(TableUpdatesGenerator.java:521)
at com.haulmont.studio.backend.ed.ddl.TableUpdatesGenerator.processing(TableUpdatesGenerator.java:117)
at com.haulmont.studio.backend.ed.ddl.AbstractDdlGenerator.generateTableUpdates(AbstractDdlGenerator.java:503)
at com.haulmont.studio.backend.ed.ddl.AbstractDdlGenerator.generateUpdates(AbstractDdlGenerator.java:490)
at com.intellij.openapi.progress.impl.CoreProgressManager$1.run(CoreProgressManager.java:219)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:888)
at com.intellij.openapi.progress.impl.CoreProgressManager$5.run(CoreProgressManager.java:441)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:163)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:585)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:531)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:150)
at com.intellij.openapi.application.impl.ApplicationImpl.lambda$null$4(ApplicationImpl.java:441)
at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:221)
at com.intellij.util.ConcurrencyUtil.lambda$underThreadNameRunnable$3(ConcurrencyUtil.java:209)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:238)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
2020-08-30 18:12:09,709 [ 22625] INFO - rationStore.ComponentStoreImpl - Saving Project (name=SheelLegal, containerState=ACTIVE, componentStore=C:\Users\Umesh\StudioProjects\SheelLegal) libraryTable took 19 ms

This may be similar to Studio Error NullPointerException where generate DB Script - CUBA.Platform.

Please ADVISE

I found that all keys and indexes are missing in database. I created unique id and now it is working fine.

I have recreated all index from init sql for entities created by me But indexes for cuba generated tables are also missing, How can i recreate them. (recreating database is not an option, as i have 50,000 records in one table).

You can open the create-db.sql file for the CUBA and all necessary add-ons on the github:

release 7.2:

Copy and run index creation statements manually.