Skip to content

Commit 711c9ce

Browse files
committed
remove remaining sheets references
1 parent b23fb89 commit 711c9ce

File tree

2 files changed

+6
-81
lines changed

2 files changed

+6
-81
lines changed

STREAMSOURCE_INTEGRATION_GUIDE.md

Lines changed: 3 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -128,51 +128,8 @@ class BackendManager {
128128
}
129129
```
130130

131-
## Step 3: Map Data Between Backends
132131

133-
Create mappers to handle differences between backends:
134-
135-
```javascript
136-
class DataMapper {
137-
// Legacy to StreamSource
138-
legacyToStreamSource(legacyRow) {
139-
return {
140-
source: sheetRow.streamerName,
141-
link: sheetRow.streamUrl,
142-
status: this.mapStatus(sheetRow.status),
143-
platform: this.detectPlatform(sheetRow.streamUrl),
144-
title: sheetRow.title,
145-
notes: sheetRow.description
146-
};
147-
}
148-
149-
// StreamSource to Legacy format
150-
streamSourceToLegacy(stream) {
151-
return {
152-
id: stream.id,
153-
streamerName: stream.source,
154-
streamUrl: stream.link,
155-
status: stream.status,
156-
platform: stream.platform,
157-
title: stream.title,
158-
description: stream.notes,
159-
lastChecked: stream.last_checked_at,
160-
createdAt: stream.created_at
161-
};
162-
}
163-
164-
detectPlatform(url) {
165-
if (url.includes('tiktok.com')) return 'TikTok';
166-
if (url.includes('facebook.com')) return 'Facebook';
167-
if (url.includes('twitch.tv')) return 'Twitch';
168-
if (url.includes('youtube.com')) return 'YouTube';
169-
if (url.includes('instagram.com')) return 'Instagram';
170-
return 'Other';
171-
}
172-
}
173-
```
174-
175-
## Step 4: Implement Core Operations
132+
## Step 3: Implement Core Operations
176133

177134
```javascript
178135
class StreamManager {
@@ -218,7 +175,7 @@ class StreamManager {
218175
}
219176
```
220177

221-
## Step 5: Handle Rate Limiting and Errors
178+
## Step 4: Handle Rate Limiting and Errors
222179

223180
```javascript
224181
class RateLimitedBackend extends StreamSourceBackend {
@@ -248,39 +205,7 @@ class RateLimitedBackend extends StreamSourceBackend {
248205
}
249206
```
250207

251-
## Step 6: Migration Strategy
252-
253-
### 1. Dual-Write Phase
254-
- Continue using legacy backend as primary
255-
- Write new data to both backends
256-
- Monitor for consistency
257-
258-
### 2. Migration Script
259-
```javascript
260-
async function migrateFromSheets() {
261-
const legacy = new LegacyBackend();
262-
const streamSource = new StreamSourceBackend();
263-
const mapper = new DataMapper();
264-
265-
const sheetData = await sheets.getAllStreams();
266-
267-
for (const row of sheetData) {
268-
const streamData = mapper.sheetsToStreamSource(row);
269-
try {
270-
await streamSource.createStream(streamData);
271-
console.log(`Migrated: ${streamData.source}`);
272-
} catch (error) {
273-
console.error(`Failed to migrate ${row.id}:`, error);
274-
}
275-
}
276-
}
277-
```
278-
279-
### 3. Cutover
280-
- Switch primary backend to StreamSource
281-
- Keep legacy backend as read-only backup
282-
283-
## Step 7: Configuration
208+
## Step 5: Configuration
284209

285210
```javascript
286211
const config = {

db/migrate/20250617013537_update_streams_to_match_google_sheet.rb renamed to db/migrate/20250617013537_update_streams_schema.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
class UpdateStreamsToMatchGoogleSheet < ActiveRecord::Migration[8.0]
1+
class UpdateStreamsSchema < ActiveRecord::Migration[8.0]
22
def change
3-
# Rename existing fields to match Google Sheet naming
3+
# Rename existing fields for better clarity
44
rename_column :streams, :name, :source
55
rename_column :streams, :url, :link
66

77
# Remove the existing status column (we'll recreate it with new values)
88
remove_column :streams, :status, :string
99

10-
# Add new fields from Google Sheet
10+
# Add new fields for enhanced stream tracking
1111
add_column :streams, :city, :string
1212
add_column :streams, :state, :string
1313
add_column :streams, :platform, :string

0 commit comments

Comments
 (0)