package main import ( "context" "flag" "fmt" "log" "os" "custom-start-page/internal/storage" ) func main() { endpoint := flag.String("endpoint", "http://localhost:8000", "DynamoDB endpoint") flag.Parse() ctx := context.Background() log.Printf("Connecting to DynamoDB at %s...", *endpoint) db, err := storage.NewDynamoDBClient(ctx, *endpoint) if err != nil { log.Fatalf("Failed to create DynamoDB client: %v", err) } // Create all tables tables := []struct { name string create func(context.Context) error }{ {"Users", db.CreateUsersTable}, {"Pages", db.CreatePagesTable}, {"Widgets", db.CreateWidgetsTable}, {"Bookmarks", db.CreateBookmarksTable}, {"Notes", db.CreateNotesTable}, {"TagAssociations", db.CreateTagAssociationsTable}, {"Groups", db.CreateGroupsTable}, {"SharedItems", db.CreateSharedItemsTable}, {"Preferences", db.CreatePreferencesTable}, } for _, table := range tables { log.Printf("Creating %s table...", table.name) if err := table.create(ctx); err != nil { log.Fatalf("Failed to create %s table: %v", table.name, err) } log.Printf("✓ %s table created successfully", table.name) } fmt.Println("\nDatabase initialization complete!") fmt.Println("All tables created:") for _, table := range tables { fmt.Printf(" - %s\n", table.name) } os.Exit(0) }